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
Boxiang Sun
gitlab-ce
Commits
d8675bd4
Commit
d8675bd4
authored
Oct 04, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
select group runners also in build queue service
parent
8d61d33d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
16 deletions
+62
-16
app/services/ci/update_build_queue_service.rb
app/services/ci/update_build_queue_service.rb
+12
-4
spec/services/ci/update_build_queue_service_spec.rb
spec/services/ci/update_build_queue_service_spec.rb
+50
-12
No files found.
app/services/ci/update_build_queue_service.rb
View file @
d8675bd4
...
@@ -7,8 +7,15 @@ module Ci
...
@@ -7,8 +7,15 @@ module Ci
end
end
end
end
return
unless
build
.
project
.
shared_runners_enabled?
if
build
.
project
.
group_runners_enabled?
Ci
::
Runner
.
belonging_to_group
(
build
.
project_id
).
each
do
|
runner
|
if
runner
.
can_pick?
(
build
)
runner
.
tick_runner_queue
end
end
end
if
build
.
project
.
shared_runners_enabled?
Ci
::
Runner
.
shared
.
each
do
|
runner
|
Ci
::
Runner
.
shared
.
each
do
|
runner
|
if
runner
.
can_pick?
(
build
)
if
runner
.
can_pick?
(
build
)
runner
.
tick_runner_queue
runner
.
tick_runner_queue
...
@@ -16,4 +23,5 @@ module Ci
...
@@ -16,4 +23,5 @@ module Ci
end
end
end
end
end
end
end
end
end
spec/services/ci/update_build_queue_service_spec.rb
View file @
d8675bd4
...
@@ -8,21 +8,19 @@ describe Ci::UpdateBuildQueueService do
...
@@ -8,21 +8,19 @@ describe Ci::UpdateBuildQueueService do
context
'when updating specific runners'
do
context
'when updating specific runners'
do
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
context
'when there
are
runner that can pick build'
do
context
'when there
is a
runner that can pick build'
do
before
do
before
do
build
.
project
.
runners
<<
runner
build
.
project
.
runners
<<
runner
end
end
it
'ticks runner queue value'
do
it
'ticks runner queue value'
do
expect
{
subject
.
execute
(
build
)
}
expect
{
subject
.
execute
(
build
)
}.
to
change
{
runner
.
ensure_runner_queue_value
}
.
to
change
{
runner
.
ensure_runner_queue_value
}
end
end
end
end
context
'when there
are no runners
that can pick build'
do
context
'when there
is no runner
that can pick build'
do
it
'does not tick runner queue value'
do
it
'does not tick runner queue value'
do
expect
{
subject
.
execute
(
build
)
}
expect
{
subject
.
execute
(
build
)
}.
not_to
change
{
runner
.
ensure_runner_queue_value
}
.
not_to
change
{
runner
.
ensure_runner_queue_value
}
end
end
end
end
end
end
...
@@ -30,21 +28,61 @@ describe Ci::UpdateBuildQueueService do
...
@@ -30,21 +28,61 @@ describe Ci::UpdateBuildQueueService do
context
'when updating shared runners'
do
context
'when updating shared runners'
do
let
(
:runner
)
{
create
(
:ci_runner
,
:shared
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
:shared
)
}
context
'when there
are
runner that can pick build'
do
context
'when there
is no
runner that can pick build'
do
it
'ticks runner queue value'
do
it
'ticks runner queue value'
do
expect
{
subject
.
execute
(
build
)
}
expect
{
subject
.
execute
(
build
)
}.
to
change
{
runner
.
ensure_runner_queue_value
}
.
to
change
{
runner
.
ensure_runner_queue_value
}
end
end
end
end
context
'when there
are no runners that can pick build
'
do
context
'when there
is no runner that can pick build due to tag mismatch
'
do
before
do
before
do
build
.
tag_list
=
[
:docker
]
build
.
tag_list
=
[
:docker
]
end
end
it
'does not tick runner queue value'
do
it
'does not tick runner queue value'
do
expect
{
subject
.
execute
(
build
)
}
expect
{
subject
.
execute
(
build
)
}.
not_to
change
{
runner
.
ensure_runner_queue_value
}
.
not_to
change
{
runner
.
ensure_runner_queue_value
}
end
end
context
'when there is no runner that can pick build due to being disabled on project'
do
before
do
build
.
project
.
shared_runners_enabled
=
false
end
it
'does not tick runner queue value'
do
expect
{
subject
.
execute
(
build
)
}.
not_to
change
{
runner
.
ensure_runner_queue_value
}
end
end
end
context
'when updating group runners'
do
let
(
:group
)
{
create
:group
}
let
(
:project
)
{
create
:project
,
group:
group
}
let
(
:runner
)
{
create
:ci_runner
,
groups:
[
group
]
}
context
'when there is a runner that can pick build'
do
it
'ticks runner queue value'
do
expect
{
subject
.
execute
(
build
)
}.
to
change
{
runner
.
ensure_runner_queue_value
}
end
end
context
'when there is no runner that can pick build due to tag mismatch'
do
before
do
build
.
tag_list
=
[
:docker
]
end
it
'does not tick runner queue value'
do
expect
{
subject
.
execute
(
build
)
}.
not_to
change
{
runner
.
ensure_runner_queue_value
}
end
end
context
'when there is no runner that can pick build due to being disabled on project'
do
before
do
build
.
project
.
group_runners_enabled
=
false
end
it
'does not tick runner queue value'
do
expect
{
subject
.
execute
(
build
)
}.
not_to
change
{
runner
.
ensure_runner_queue_value
}
end
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