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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0968e6ad
Commit
0968e6ad
authored
Aug 01, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak only new_builds. Revert the rest.
parent
e5fd565c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
app/models/ci/build.rb
app/models/ci/build.rb
+0
-5
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+8
-10
No files found.
app/models/ci/build.rb
View file @
0968e6ad
...
@@ -40,11 +40,6 @@ module Ci
...
@@ -40,11 +40,6 @@ module Ci
.
where
(
'ci_pipelines.protected IS TRUE'
)
.
where
(
'ci_pipelines.protected IS TRUE'
)
end
end
scope
:unprotected
,
->
()
do
joins
(
"LEFT JOIN ci_pipelines ON ci_builds.commit_id = ci_pipelines.id"
)
.
where
(
'ci_pipelines.protected IS FALSE'
)
end
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
...
...
app/services/ci/register_job_service.rb
View file @
0968e6ad
...
@@ -54,25 +54,21 @@ module Ci
...
@@ -54,25 +54,21 @@ module Ci
private
private
def
builds_for_shared_runner
def
builds_for_shared_runner
b
=
new_builds
.
new_builds
.
# don't run projects which have not enabled shared runners and builds
# don't run projects which have not enabled shared runners and builds
joins
(
:project
).
where
(
projects:
{
shared_runners_enabled:
true
,
pending_delete:
false
})
joins
(
:project
).
where
(
projects:
{
shared_runners_enabled:
true
,
pending_delete:
false
})
.
joins
(
'LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id'
)
.
joins
(
'LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id'
)
.
where
(
'project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'
)
.
where
(
'project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'
)
.
b
=
runner
.
protected?
?
b
.
on_protected
:
b
.
unprotected
# Implement fair scheduling
# Implement fair scheduling
# this returns builds that are ordered by number of running builds
# this returns builds that are ordered by number of running builds
# we prefer projects that don't use shared runners at all
# we prefer projects that don't use shared runners at all
b
.
joins
(
"LEFT JOIN (
#{
running_builds_for_shared_runners
.
to_sql
}
) AS project_builds ON ci_builds.project_id=project_builds.project_id"
)
joins
(
"LEFT JOIN (
#{
running_builds_for_shared_runners
.
to_sql
}
) AS project_builds ON ci_builds.project_id=project_builds.project_id"
)
.
order
(
'COALESCE(project_builds.running_builds, 0) ASC'
,
'ci_builds.id ASC'
)
.
order
(
'COALESCE(project_builds.running_builds, 0) ASC'
,
'ci_builds.id ASC'
)
end
end
def
builds_for_specific_runner
def
builds_for_specific_runner
b
=
new_builds
.
where
(
project:
runner
.
projects
.
without_deleted
.
with_builds_enabled
)
new_builds
.
where
(
project:
runner
.
projects
.
without_deleted
.
with_builds_enabled
).
order
(
'created_at ASC'
)
b
=
runner
.
protected?
?
b
.
on_protected
:
b
.
unprotected
b
.
order
(
'created_at ASC'
)
end
end
def
running_builds_for_shared_runners
def
running_builds_for_shared_runners
...
@@ -81,7 +77,9 @@ module Ci
...
@@ -81,7 +77,9 @@ module Ci
end
end
def
new_builds
def
new_builds
Ci
::
Build
.
pending
.
unstarted
builds
=
Ci
::
Build
.
pending
.
unstarted
builds
=
builds
.
on_protected
if
runner
.
protected?
builds
end
end
def
shared_runner_build_limits_feature_enabled?
def
shared_runner_build_limits_feature_enabled?
...
...
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