Commit 81c0c57a authored by Alexis Reigel's avatar Alexis Reigel Committed by Alexis Reigel

exclude group runners on projects that disabled it

parent 677291b6
......@@ -35,13 +35,16 @@ module Ci
%{
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 projects group_projects ON group_projects.namespace_id = namespaces.id
INNER JOIN projects ON projects.namespace_id = namespaces.id
}
).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)
......
......@@ -83,6 +83,14 @@ describe Ci::Runner do
expect(described_class.owned_or_shared(specific_project.id)).to eq [specific_runner]
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
group = create :group
runner = create :ci_runner, :shared, groups: [group]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment