Commit 42c08a02 authored by Pavel Shutsin's avatar Pavel Shutsin

Merge branch '339198-fj-ci-owned-runners' into 'master'

Use linear version of User#ci_owned_runners

See merge request gitlab-org/gitlab!68848
parents 6a9c73e7 a3454700
......@@ -1614,8 +1614,14 @@ class User < ApplicationRecord
.joins(:runner)
.select('ci_runners.*')
base_and_descendants = if Feature.enabled?(:linear_user_ci_owned_runners, self, default_enabled: :yaml)
owned_groups.self_and_descendant_ids
else
Gitlab::ObjectHierarchy.new(owned_groups).base_and_descendants.select(:id)
end
group_runners = Ci::RunnerNamespace
.where(namespace_id: Gitlab::ObjectHierarchy.new(owned_groups).base_and_descendants.select(:id))
.where(namespace_id: base_and_descendants)
.joins(:runner)
.select('ci_runners.*')
......
---
name: linear_user_ci_owned_runners
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68848
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339435
milestone: '14.6'
type: development
group: group::access
default_enabled: false
......@@ -3673,6 +3673,7 @@ RSpec.describe User do
end
describe '#ci_owned_runners' do
shared_examples 'ci_owned_runners examples' do
let(:user) { create(:user) }
shared_examples :nested_groups_owner do
......@@ -3979,6 +3980,17 @@ RSpec.describe User do
end
end
it_behaves_like 'ci_owned_runners examples'
context 'when feature flag :linear_user_ci_owned_runners is disabled' do
before do
stub_feature_flags(linear_user_ci_owned_runners: false)
end
it_behaves_like 'ci_owned_runners examples'
end
end
describe '#projects_with_reporter_access_limited_to' do
let(:project1) { create(:project) }
let(:project2) { create(:project) }
......
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