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
1d07fb38
Commit
1d07fb38
authored
Dec 09, 2021
by
Maxime Orefice
Committed by
Dylan Griffith
Dec 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Ci::PendingBuild async when shared runner is toggled
parent
24946c7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
app/services/groups/update_shared_runners_service.rb
app/services/groups/update_shared_runners_service.rb
+11
-5
spec/services/groups/update_shared_runners_service_spec.rb
spec/services/groups/update_shared_runners_service_spec.rb
+6
-0
No files found.
app/services/groups/update_shared_runners_service.rb
View file @
1d07fb38
...
...
@@ -8,7 +8,7 @@ module Groups
validate_params
update_shared_runners
update_pending_builds
!
update_pending_builds
_async
success
...
...
@@ -28,12 +28,18 @@ module Groups
group
.
update_shared_runners_setting!
(
params
[
:shared_runners_setting
])
end
def
update_pending_builds!
return
unless
group
.
previous_changes
.
include?
(
'shared_runners_enabled'
)
def
update_pending_builds?
group
.
previous_changes
.
include?
(
'shared_runners_enabled'
)
end
def
update_pending_builds_async
return
unless
update_pending_builds?
update_params
=
{
instance_runners_enabled:
group
.
shared_runners_enabled
}
group
.
run_after_commit_or_now
do
|
group
|
pending_builds_params
=
{
instance_runners_enabled:
group
.
shared_runners_enabled
}
::
Ci
::
UpdatePendingBuildService
.
new
(
group
,
update_params
).
execute
::
Ci
::
UpdatePendingBuildService
.
new
(
group
,
pending_builds_params
).
execute
end
end
end
end
spec/services/groups/update_shared_runners_service_spec.rb
View file @
1d07fb38
...
...
@@ -63,6 +63,8 @@ RSpec.describe Groups::UpdateSharedRunnersService do
let_it_be
(
:pending_build_2
)
{
create
(
:ci_pending_build
,
project:
project
,
instance_runners_enabled:
false
)
}
it
'updates pending builds for the group'
do
expect
(
::
Ci
::
UpdatePendingBuildService
).
to
receive
(
:new
).
and_call_original
subject
expect
(
pending_build_1
.
reload
.
instance_runners_enabled
).
to
be_truthy
...
...
@@ -73,6 +75,8 @@ RSpec.describe Groups::UpdateSharedRunnersService do
let
(
:params
)
{
{
shared_runners_setting:
'invalid_enabled'
}
}
it
'does not update pending builds for the group'
do
expect
(
::
Ci
::
UpdatePendingBuildService
).
not_to
receive
(
:new
).
and_call_original
subject
expect
(
pending_build_1
.
reload
.
instance_runners_enabled
).
to
be_falsey
...
...
@@ -99,6 +103,8 @@ RSpec.describe Groups::UpdateSharedRunnersService do
let_it_be
(
:pending_build_2
)
{
create
(
:ci_pending_build
,
project:
project
,
instance_runners_enabled:
true
)
}
it
'updates pending builds for the group'
do
expect
(
::
Ci
::
UpdatePendingBuildService
).
to
receive
(
:new
).
and_call_original
subject
expect
(
pending_build_1
.
reload
.
instance_runners_enabled
).
to
be_falsey
...
...
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