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
85def17c
Commit
85def17c
authored
Jun 09, 2021
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track running shared runner builds using runtime metadata
parent
2fb3c041
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
app/models/ci/build.rb
app/models/ci/build.rb
+22
-9
app/services/ci/update_build_queue_service.rb
app/services/ci/update_build_queue_service.rb
+5
-3
No files found.
app/models/ci/build.rb
View file @
85def17c
...
...
@@ -300,7 +300,7 @@ module Ci
end
# rubocop:disable CodeReuse/ServiceClass
after_transition
any
=>
[
:pending
]
do
|
build
,
transition
|
after_transition
any
: :pending
do
|
build
,
transition
|
Ci
::
UpdateBuildQueueService
.
new
.
push
(
build
,
transition
)
build
.
run_after_commit
do
...
...
@@ -311,7 +311,22 @@ module Ci
after_transition
pending:
any
do
|
build
,
transition
|
Ci
::
UpdateBuildQueueService
.
new
.
pop
(
build
,
transition
)
end
after_transition
any: :running
do
|
build
,
transition
|
Ci
::
UpdateBuildQueueService
.
new
.
track
(
build
,
transition
)
end
after_transition
running:
any
do
|
build
|
Ci
::
UpdateBuildQueueService
.
new
.
untrack
(
build
,
transition
)
Ci
::
BuildRunnerSession
.
where
(
build:
build
).
delete_all
end
# rubocop:enable CodeReuse/ServiceClass
#
after_transition
pending: :running
do
|
build
|
build
.
ensure_metadata
.
update_timeout_state
end
after_transition
pending: :running
do
|
build
|
build
.
deployment
&
.
run
...
...
@@ -365,14 +380,6 @@ module Ci
end
end
after_transition
pending: :running
do
|
build
|
build
.
ensure_metadata
.
update_timeout_state
end
after_transition
running:
any
do
|
build
|
Ci
::
BuildRunnerSession
.
where
(
build:
build
).
delete_all
end
after_transition
any
=>
[
:skipped
,
:canceled
]
do
|
build
,
transition
|
if
transition
.
to_name
==
:skipped
build
.
deployment
&
.
skip
...
...
@@ -1087,6 +1094,12 @@ module Ci
::
Ci
::
RunningBuild
.
where
(
build_id:
self
.
id
)
end
def
shared_runner_build?
return
false
if
runner
.
nil?
runner
.
instance_type?
end
protected
def
run_status_commit_hooks!
...
...
app/services/ci/update_build_queue_service.rb
View file @
85def17c
...
...
@@ -49,11 +49,11 @@ module Ci
end
##
# Add shared runner build tracking entry (used for queuing). This will rase
# an exception if a build has not been picked by a shared runner.
# Add shared runner build tracking entry (used for queuing).
#
def
track
(
build
,
transition
)
return
unless
Feature
.
enabled?
(
:ci_track_shared_runner_builds
,
build
.
project
,
default_enabled: :yaml
)
return
unless
build
.
shared_runner_build?
raise
InvalidQueueTransition
unless
transition
.
to
==
'running'
...
...
@@ -69,10 +69,12 @@ module Ci
end
##
# Remove a runtime build tracking entry (used for queuing).
# Remove a runtime build tracking entry for a shared runner build (used for
# queuing).
#
def
untrack
(
build
,
transition
)
return
unless
Feature
.
enabled?
(
:ci_untrack_shared_runner_builds
,
build
.
project
,
default_enabled: :yaml
)
return
unless
build
.
shared_runner_build?
raise
InvalidQueueTransition
unless
transition
.
from
==
'running'
...
...
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