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
49ac9081
Commit
49ac9081
authored
Oct 26, 2015
by
Robert Speicher
Committed by
Robert Speicher
Oct 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix-specific-runner-visibility' into 'master'
Fix visibility of specific runners See merge request !1688
parent
4b40dae3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
24 deletions
+20
-24
CHANGELOG
CHANGELOG
+1
-10
app/controllers/projects/runners_controller.rb
app/controllers/projects/runners_controller.rb
+4
-5
app/models/ci/runner.rb
app/models/ci/runner.rb
+1
-0
app/models/user.rb
app/models/user.rb
+14
-9
No files found.
CHANGELOG
View file @
49ac9081
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.2.0 (unreleased)
- Improved performance of replacing references in comments
- Show last project commit to default branch on project home page
- Highlight comment based on anchor in URL
- Adds ability to remove the forked relationship from project settings screen. (Han Loong Liauw)
- Improved performance of sorting milestone issues
- Allow users to select the Files view as default project view (Cristian Bica)
- Show "Empty Repository Page" for repository without branches (Artem V. Navrotskiy)
- Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork
v 8.1.1
v 8.1.1
- Fix cloning Wiki repositories via HTTP (Stan Hu)
- Fix cloning Wiki repositories via HTTP (Stan Hu)
- Add migration to remove satellites directory
- Add migration to remove satellites directory
- Fix specific runners visibility
v 8.1.0
v 8.1.0
- Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu)
- Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu)
...
...
app/controllers/projects/runners_controller.rb
View file @
49ac9081
...
@@ -6,11 +6,10 @@ class Projects::RunnersController < Projects::ApplicationController
...
@@ -6,11 +6,10 @@ class Projects::RunnersController < Projects::ApplicationController
layout
'project_settings'
layout
'project_settings'
def
index
def
index
@runners
=
@ci_project
.
runners
.
order
(
'id DESC'
)
@runners
=
@ci_project
.
runners
.
ordered
@specific_runners
=
@specific_runners
=
current_user
.
ci_authorized_runners
.
Ci
::
Runner
.
specific
.
includes
(
:runner_projects
).
where
.
not
(
id:
@ci_project
.
runners
).
where
(
Ci
::
RunnerProject
.
table_name
=>
{
project_id:
current_user
.
authorized_projects
}
).
ordered
.
page
(
params
[
:page
]).
per
(
20
)
where
.
not
(
id:
@runners
).
order
(
"
#{
Ci
::
Runner
.
table_name
}
.id DESC"
).
page
(
params
[
:page
]).
per
(
20
)
@shared_runners
=
Ci
::
Runner
.
shared
.
active
@shared_runners
=
Ci
::
Runner
.
shared
.
active
@shared_runners_count
=
@shared_runners
.
count
(
:all
)
@shared_runners_count
=
@shared_runners
.
count
(
:all
)
end
end
...
...
app/models/ci/runner.rb
View file @
49ac9081
...
@@ -36,6 +36,7 @@ module Ci
...
@@ -36,6 +36,7 @@ module Ci
scope
:active
,
->
()
{
where
(
active:
true
)
}
scope
:active
,
->
()
{
where
(
active:
true
)
}
scope
:paused
,
->
()
{
where
(
active:
false
)
}
scope
:paused
,
->
()
{
where
(
active:
false
)
}
scope
:online
,
->
()
{
where
(
'contacted_at > ?'
,
LAST_CONTACT_TIME
)
}
scope
:online
,
->
()
{
where
(
'contacted_at > ?'
,
LAST_CONTACT_TIME
)
}
scope
:ordered
,
->
()
{
order
(
id: :desc
)
}
acts_as_taggable
acts_as_taggable
...
...
app/models/user.rb
View file @
49ac9081
...
@@ -401,15 +401,17 @@ class User < ActiveRecord::Base
...
@@ -401,15 +401,17 @@ class User < ActiveRecord::Base
end
end
end
end
def
authorized_projects_id
@authorized_projects_id
||=
begin
project_ids
=
personal_projects
.
pluck
(
:id
)
project_ids
.
push
(
*
groups_projects
.
pluck
(
:id
))
project_ids
.
push
(
*
projects
.
pluck
(
:id
).
uniq
)
end
end
# Projects user has access to
# Projects user has access to
def
authorized_projects
def
authorized_projects
@authorized_projects
||=
begin
@authorized_projects
||=
Project
.
where
(
id:
authorized_projects_id
)
project_ids
=
personal_projects
.
pluck
(
:id
)
project_ids
.
push
(
*
groups_projects
.
pluck
(
:id
))
project_ids
.
push
(
*
projects
.
pluck
(
:id
).
uniq
)
Project
.
where
(
id:
project_ids
)
end
end
end
def
owned_projects
def
owned_projects
...
@@ -765,11 +767,14 @@ class User < ActiveRecord::Base
...
@@ -765,11 +767,14 @@ class User < ActiveRecord::Base
end
end
def
ci_authorized_projects
def
ci_authorized_projects
@ci_authorized_projects
||=
Ci
::
Project
.
where
(
gitlab_id:
authorized_projects
)
@ci_authorized_projects
||=
Ci
::
Project
.
where
(
gitlab_id:
authorized_projects
_id
)
end
end
def
ci_authorized_runners
def
ci_authorized_runners
Ci
::
Runner
.
specific
.
includes
(
:runner_projects
).
@ci_authorized_runners
||=
begin
where
(
ci_runner_projects:
{
project_id:
ci_authorized_projects
}
)
runner_ids
=
Ci
::
RunnerProject
.
joins
(
:project
).
where
(
ci_projects:
{
gitlab_id:
authorized_projects_id
}).
select
(
:runner_id
)
Ci
::
Runner
.
specific
.
where
(
id:
runner_ids
)
end
end
end
end
end
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