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
9ccc7c29
Commit
9ccc7c29
authored
Nov 30, 2021
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decouple writing pending builds from FFs class and actors
parent
910bbbfa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
15 deletions
+15
-15
app/models/ci/pending_build.rb
app/models/ci/pending_build.rb
+5
-1
app/services/ci/update_build_queue_service.rb
app/services/ci/update_build_queue_service.rb
+6
-6
app/services/ci/update_pending_build_service.rb
app/services/ci/update_pending_build_service.rb
+1
-1
config/feature_flags/development/ci_pending_builds_maintain_denormalized_data.yml
...elopment/ci_pending_builds_maintain_denormalized_data.yml
+1
-1
ee/app/models/ee/ci/pending_build.rb
ee/app/models/ee/ci/pending_build.rb
+1
-1
ee/app/services/ci/minutes/refresh_cached_data_service.rb
ee/app/services/ci/minutes/refresh_cached_data_service.rb
+1
-1
lib/gitlab/ci/features.rb
lib/gitlab/ci/features.rb
+0
-4
No files found.
app/models/ci/pending_build.rb
View file @
9ccc7c29
...
...
@@ -30,6 +30,10 @@ module Ci
self
.
upsert
(
entry
.
attributes
.
compact
,
returning:
%w[build_id]
,
unique_by: :build_id
)
end
def
maintain_denormalized_data?
::
Feature
.
enabled?
(
:ci_pending_builds_maintain_denormalized_data
,
default_enabled: :yaml
)
end
private
def
args_from_build
(
build
)
...
...
@@ -42,7 +46,7 @@ module Ci
namespace:
project
.
namespace
}
if
::
Gitlab
::
Ci
::
Features
.
pending_builds_maintain_denormalized_data?
(
project
)
if
maintain_denormalized_data?
args
.
store
(
:tag_ids
,
build
.
tags_ids
)
args
.
store
(
:instance_runners_enabled
,
shared_runners_enabled?
(
project
))
args
.
store
(
:namespace_traversal_ids
,
project
.
namespace
.
traversal_ids
)
if
group_runners_enabled?
(
project
)
...
...
app/services/ci/update_build_queue_service.rb
View file @
9ccc7c29
...
...
@@ -14,7 +14,7 @@ module Ci
# Add a build to the pending builds queue
#
def
push
(
build
,
transition
)
return
unless
maintain_pending_builds_queue?
(
build
)
return
unless
maintain_pending_builds_queue?
raise
InvalidQueueTransition
unless
transition
.
to
==
'pending'
...
...
@@ -33,7 +33,7 @@ module Ci
# Remove a build from the pending builds queue
#
def
pop
(
build
,
transition
)
return
unless
maintain_pending_builds_queue?
(
build
)
return
unless
maintain_pending_builds_queue?
raise
InvalidQueueTransition
unless
transition
.
from
==
'pending'
...
...
@@ -52,7 +52,7 @@ module Ci
# Add shared runner build tracking entry (used for queuing).
#
def
track
(
build
,
transition
)
return
unless
maintain_pending_builds_queue?
(
build
)
return
unless
maintain_pending_builds_queue?
return
unless
build
.
shared_runner_build?
raise
InvalidQueueTransition
unless
transition
.
to
==
'running'
...
...
@@ -73,7 +73,7 @@ module Ci
# queuing).
#
def
untrack
(
build
,
transition
)
return
unless
maintain_pending_builds_queue?
(
build
)
return
unless
maintain_pending_builds_queue?
return
unless
build
.
shared_runner_build?
raise
InvalidQueueTransition
unless
transition
.
from
==
'running'
...
...
@@ -113,8 +113,8 @@ module Ci
end
end
def
maintain_pending_builds_queue?
(
build
)
::
Gitlab
::
Ci
::
Features
.
pending_builds_maintain_denormalized_data?
(
build
.
project
)
def
maintain_pending_builds_queue?
::
Ci
::
PendingBuild
.
maintain_denormalized_data?
end
end
end
app/services/ci/update_pending_build_service.rb
View file @
9ccc7c29
...
...
@@ -15,7 +15,7 @@ module Ci
end
def
execute
return
unless
::
Gitlab
::
Ci
::
Features
.
pending_builds_maintain_denormalized_data?
(
@model
)
return
unless
::
Ci
::
PendingBuild
.
maintain_denormalized_data?
@model
.
pending_builds
.
each_batch
do
|
relation
|
relation
.
update_all
(
@update_params
)
...
...
config/feature_flags/development/ci_pending_builds_maintain_denormalized_data.yml
View file @
9ccc7c29
---
name
:
ci_pending_builds_maintain_denormalized_data
introduced_by_url
:
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75425
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/332951
milestone
:
'
14.6'
type
:
development
...
...
ee/app/models/ee/ci/pending_build.rb
View file @
9ccc7c29
...
...
@@ -14,7 +14,7 @@ module EE
override
:args_from_build
def
args_from_build
(
build
)
return
super
unless
::
Gitlab
::
Ci
::
Features
.
pending_builds_maintain_denormalized_data?
(
build
&
.
project
&
.
root_namespace
)
return
super
unless
maintain_denormalized_data?
super
.
merge
(
minutes_exceeded:
minutes_exceeded?
(
build
.
project
))
end
...
...
ee/app/services/ci/minutes/refresh_cached_data_service.rb
View file @
9ccc7c29
...
...
@@ -27,7 +27,7 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def
update_pending_builds!
return
unless
::
Gitlab
::
Ci
::
Features
.
pending_builds_maintain_denormalized_data?
(
@root_namespace
)
return
unless
::
Ci
::
PendingBuild
.
maintain_denormalized_data?
minutes_exceeded
=
@root_namespace
.
ci_minutes_quota
.
minutes_used_up?
all_namespace_ids
=
@root_namespace
.
self_and_descendant_ids
.
ids
...
...
lib/gitlab/ci/features.rb
View file @
9ccc7c29
...
...
@@ -25,10 +25,6 @@ module Gitlab
def
self
.
gldropdown_tags_enabled?
::
Feature
.
enabled?
(
:gldropdown_tags
,
default_enabled: :yaml
)
end
def
self
.
pending_builds_maintain_denormalized_data?
(
actor
)
::
Feature
.
enabled?
(
:ci_pending_builds_maintain_denormalized_data
,
actor
,
default_enabled: :yaml
)
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