exclude group runners on projects that disabled it
This commit is contained in:
parent
677291b6a7
commit
81c0c57acd
2 changed files with 14 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue