Commit 207138f3 authored by Marius Bobin's avatar Marius Bobin

Add feature flag for controlling the rollout

Add feature flag for controlling the decoupling rollout
parent 04a2a993
...@@ -47,7 +47,7 @@ module Ci ...@@ -47,7 +47,7 @@ module Ci
def builds_for_project_runner def builds_for_project_runner
relation = new_builds relation = new_builds
.where(project: runner.runner_projects.select(:project_id)) .where(project: runner_projects_relation)
order(relation) order(relation)
end end
...@@ -87,6 +87,14 @@ module Ci ...@@ -87,6 +87,14 @@ module Ci
end end
end end
end end
def runner_projects_relation
if ::Feature.enabled?(:ci_pending_builds_project_runners_decoupling, runner, default_enabled: :yaml)
runner.runner_projects.select(:project_id)
else
runner.projects.without_deleted.with_builds_enabled
end
end
end end
end end
end end
......
---
name: ci_pending_builds_project_runners_decoupling
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70415
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/341005
milestone: '14.4'
type: development
group: group::pipeline execution
default_enabled: false
...@@ -79,6 +79,16 @@ module Ci ...@@ -79,6 +79,16 @@ module Ci
expect(execute(shared_runner)).to be_nil expect(execute(shared_runner)).to be_nil
end end
end end
context 'for specific runner' do
before do
stub_feature_flags(ci_pending_builds_project_runners_decoupling: false)
end
it 'does not pick a build' do
expect(execute(specific_runner)).to be_nil
end
end
end end
context 'allow shared runners' do context 'allow shared runners' do
...@@ -228,6 +238,16 @@ module Ci ...@@ -228,6 +238,16 @@ module Ci
it { expect(build).to be_nil } it { expect(build).to be_nil }
end end
context 'and uses project runner' do
before do
stub_feature_flags(ci_pending_builds_project_runners_decoupling: false)
end
let(:build) { execute(specific_runner) }
it { expect(build).to be_nil }
end
end end
context 'allow group runners' do context 'allow group runners' do
......
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