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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
92776d4c
Commit
92776d4c
authored
Feb 08, 2022
by
Mayra Cabrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '336436-change-db-index-for-ci_owned_runners' into 'master'"
This reverts merge request !79729
parent
115add63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
24 deletions
+9
-24
app/models/ci/namespace_mirror.rb
app/models/ci/namespace_mirror.rb
+0
-3
app/models/user.rb
app/models/user.rb
+9
-21
No files found.
app/models/ci/namespace_mirror.rb
View file @
92776d4c
...
...
@@ -15,9 +15,6 @@ module Ci
end
scope
:by_namespace_id
,
->
(
namespace_id
)
{
where
(
namespace_id:
namespace_id
)
}
scope
:namespace_id_from_traversal_ids
,
->
do
select
(
'ci_namespace_mirrors.traversal_ids[array_length(ci_namespace_mirrors.traversal_ids, 1)] AS namespace_id'
)
end
class
<<
self
def
sync!
(
event
)
...
...
app/models/user.rb
View file @
92776d4c
...
...
@@ -2230,32 +2230,20 @@ class User < ApplicationRecord
end
def
ci_owned_project_runners_from_group_members
cte_project_ids
=
Gitlab
::
SQL
::
CTE
.
new
(
:cte_project_ids
,
Ci
::
ProjectMirror
.
select
(
:project_id
)
.
joins
(
'JOIN ci_namespace_mirrors ON ci_namespace_mirrors.traversal_ids[array_length(ci_namespace_mirrors.traversal_ids, 1)] = ci_project_mirrors.namespace_id'
)
.
merge
(
ci_namespace_mirrors_for_group_members
(
Gitlab
::
Access
::
MAINTAINER
))
)
Ci
::
Runner
Ci
::
RunnerProject
.
select
(
'ci_runners.*'
)
.
joins
(
:runner_projects
)
.
where
(
'ci_runner_projects.project_id IN (SELECT project_id FROM cte_project_ids)'
)
.
with
(
cte_project_ids
.
to_arel
)
.
joins
(
:runner
)
.
joins
(
'JOIN ci_project_mirrors ON ci_project_mirrors.project_id = ci_runner_projects.project_id'
)
.
joins
(
'JOIN ci_namespace_mirrors ON ci_namespace_mirrors.namespace_id = ci_project_mirrors.namespace_id'
)
.
merge
(
ci_namespace_mirrors_for_group_members
(
Gitlab
::
Access
::
MAINTAINER
))
end
def
ci_owned_group_runners
cte_namespace_ids
=
Gitlab
::
SQL
::
CTE
.
new
(
:cte_namespace_ids
,
ci_namespace_mirrors_for_group_members
(
Gitlab
::
Access
::
OWNER
).
namespace_id_from_traversal_ids
)
Ci
::
Runner
Ci
::
RunnerNamespace
.
select
(
'ci_runners.*'
)
.
joins
(
:runner
_namespaces
)
.
where
(
'ci_runner_namespaces.namespace_id IN (SELECT namespace_id FROM cte_namespace_ids)
'
)
.
with
(
cte_namespace_ids
.
to_arel
)
.
joins
(
:runner
)
.
joins
(
'JOIN ci_namespace_mirrors ON ci_namespace_mirrors.namespace_id = ci_runner_namespaces.namespace_id
'
)
.
merge
(
ci_namespace_mirrors_for_group_members
(
Gitlab
::
Access
::
OWNER
)
)
end
def
ci_namespace_mirrors_for_group_members
(
level
)
...
...
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