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
78556e3f
Commit
78556e3f
authored
Dec 10, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge CI queuing denomalization feature flags into a single one
Changelog: other
parent
87c7d3ae
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
100 deletions
+32
-100
app/services/ci/queue/build_queue_service.rb
app/services/ci/queue/build_queue_service.rb
+1
-1
app/services/ci/queue/builds_table_strategy.rb
app/services/ci/queue/builds_table_strategy.rb
+1
-9
app/services/ci/queue/pending_builds_strategy.rb
app/services/ci/queue/pending_builds_strategy.rb
+5
-13
config/feature_flags/development/ci_queueing_denormalize_ci_minutes_information.yml
...opment/ci_queueing_denormalize_ci_minutes_information.yml
+0
-8
config/feature_flags/development/ci_queueing_denormalize_namespace_traversal_ids.yml
...pment/ci_queueing_denormalize_namespace_traversal_ids.yml
+0
-8
config/feature_flags/development/ci_queueing_denormalize_shared_runners_information.yml
...nt/ci_queueing_denormalize_shared_runners_information.yml
+0
-8
config/feature_flags/development/ci_queuing_use_denormalized_data_strategy.yml
...development/ci_queuing_use_denormalized_data_strategy.yml
+5
-5
ee/app/services/ee/ci/queue/build_queue_service.rb
ee/app/services/ee/ci/queue/build_queue_service.rb
+2
-2
ee/spec/services/ci/register_job_service_spec.rb
ee/spec/services/ci/register_job_service_spec.rb
+12
-12
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+6
-34
No files found.
app/services/ci/queue/build_queue_service.rb
View file @
78556e3f
...
...
@@ -24,7 +24,7 @@ module Ci
# rubocop:disable CodeReuse/ActiveRecord
def
builds_for_group_runner
if
strategy
.
use_denormalized_
namespace_traversal_ids
?
if
strategy
.
use_denormalized_
data_strategy
?
strategy
.
builds_for_group_runner
else
# Workaround for weird Rails bug, that makes `runner.groups.to_sql` to return `runner_id = NULL`
...
...
app/services/ci/queue/builds_table_strategy.rb
View file @
78556e3f
...
...
@@ -57,15 +57,7 @@ module Ci
relation
.
pluck
(
:id
)
end
def
use_denormalized_shared_runners_data?
false
end
def
use_denormalized_minutes_data?
false
end
def
use_denormalized_namespace_traversal_ids?
def
use_denormalized_data_strategy?
false
end
...
...
app/services/ci/queue/pending_builds_strategy.rb
View file @
78556e3f
...
...
@@ -23,7 +23,7 @@ module Ci
end
def
builds_matching_tag_ids
(
relation
,
ids
)
if
::
Feature
.
enabled?
(
:ci_queueing_denormalize_tags_information
,
runner
,
default_enabled: :yaml
)
if
use_denormalized_data_strategy?
relation
.
for_tags
(
runner
.
tags_ids
)
else
relation
.
merge
(
CommitStatus
.
matches_tag_ids
(
ids
,
table:
'ci_pending_builds'
,
column:
'build_id'
))
...
...
@@ -31,7 +31,7 @@ module Ci
end
def
builds_with_any_tags
(
relation
)
if
::
Feature
.
enabled?
(
:ci_queueing_denormalize_tags_information
,
runner
,
default_enabled: :yaml
)
if
use_denormalized_data_strategy?
relation
.
where
(
'cardinality(tag_ids) > 0'
)
else
relation
.
merge
(
CommitStatus
.
with_any_tags
(
table:
'ci_pending_builds'
,
column:
'build_id'
))
...
...
@@ -50,22 +50,14 @@ module Ci
relation
.
pluck
(
:build_id
)
end
def
use_denormalized_shared_runners_data?
::
Feature
.
enabled?
(
:ci_queueing_denormalize_shared_runners_information
,
runner
,
type: :development
,
default_enabled: :yaml
)
end
def
use_denormalized_minutes_data?
::
Feature
.
enabled?
(
:ci_queueing_denormalize_ci_minutes_information
,
runner
,
type: :development
,
default_enabled: :yaml
)
end
def
use_denormalized_namespace_traversal_ids?
::
Feature
.
enabled?
(
:ci_queueing_denormalize_namespace_traversal_ids
,
runner
,
type: :development
,
default_enabled: :yaml
)
def
use_denormalized_data_strategy?
::
Feature
.
enabled?
(
:ci_queuing_use_denormalized_data_strategy
,
default_enabled: :yaml
)
end
private
def
builds_available_for_shared_runners
if
use_denormalized_
shared_runners_data
?
if
use_denormalized_
data_strategy
?
new_builds
.
with_instance_runners
else
new_builds
...
...
config/feature_flags/development/ci_queueing_denormalize_ci_minutes_information.yml
deleted
100644 → 0
View file @
87c7d3ae
---
name
:
ci_queueing_denormalize_ci_minutes_information
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66962
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/338290
milestone
:
'
14.2'
type
:
development
group
:
'
group::pipeline
execution'
default_enabled
:
false
config/feature_flags/development/ci_queueing_denormalize_namespace_traversal_ids.yml
deleted
100644 → 0
View file @
87c7d3ae
---
name
:
ci_queueing_denormalize_namespace_traversal_ids
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70162
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/340930
milestone
:
'
14.3'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
config/feature_flags/development/ci_queueing_denormalize_shared_runners_information.yml
deleted
100644 → 0
View file @
87c7d3ae
---
name
:
ci_queueing_denormalize_shared_runners_information
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66082
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/338289
milestone
:
'
14.2'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
config/feature_flags/development/ci_queu
eing_denormalize_tags_information
.yml
→
config/feature_flags/development/ci_queu
ing_use_denormalized_data_strategy
.yml
View file @
78556e3f
---
name
:
ci_queu
eing_denormalize_tags_information
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/
65648
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/33
8366
milestone
:
'
14.
1
'
name
:
ci_queu
ing_use_denormalized_data_strategy
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/
76543
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/33
2951
milestone
:
'
14.
6
'
type
:
development
group
:
group::pipeline execution
default_enabled
:
fals
e
default_enabled
:
tru
e
ee/app/services/ee/ci/queue/build_queue_service.rb
View file @
78556e3f
...
...
@@ -19,7 +19,7 @@ module EE
# rubocop: disable CodeReuse/ActiveRecord
def
enforce_minutes_based_on_cost_factors
(
relation
)
if
strategy
.
use_denormalized_
minutes_data
?
if
strategy
.
use_denormalized_
data_strategy
?
strategy
.
enforce_minutes_quota
(
relation
)
else
enforce_minutes_using_legacy_data
(
relation
)
...
...
@@ -27,7 +27,7 @@ module EE
end
def
enforce_minutes_using_legacy_data
(
relation
)
if
strategy
.
use_denormalized_
shared_runners_data
?
if
strategy
.
use_denormalized_
data_strategy
?
# If shared runners information is denormalized then the query does not include the join
# with `projects` anymore, so we need to add it until we use denormalized ci minutes
...
...
ee/spec/services/ci/register_job_service_spec.rb
View file @
78556e3f
...
...
@@ -43,17 +43,17 @@ RSpec.describe Ci::RegisterJobService, '#execute' do
is_expected
.
to
be_kind_of
(
Ci
::
Build
)
end
context
'with ci_queu
eing_denormalize_ci_minutes_information
enabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
enabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_ci_minutes_information
:
true
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
true
)
end
it
{
is_expected
.
to
be_kind_of
(
Ci
::
Build
)
}
end
context
'with ci_queu
eing_denormalize_ci_minutes_information
disabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
disabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_ci_minutes_information
:
false
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
false
)
end
around
do
|
example
|
...
...
@@ -96,17 +96,17 @@ RSpec.describe Ci::RegisterJobService, '#execute' do
is_expected
.
to
be_kind_of
(
Ci
::
Build
)
end
context
'with ci_queu
eing_denormalize_ci_minutes_information
enabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
enabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_ci_minutes_information
:
true
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
true
)
end
it
{
is_expected
.
to
be_nil
}
end
context
'with ci_queu
eing_denormalize_ci_minutes_information
disabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
disabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_ci_minutes_information
:
false
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
false
)
end
around
do
|
example
|
...
...
@@ -332,17 +332,17 @@ RSpec.describe Ci::RegisterJobService, '#execute' do
stub_feature_flags
(
ci_pending_builds_queue_source:
true
)
end
context
'with ci_queu
eing_denormalize_shared_runners_information
enabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
enabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_shared_runners_information
:
true
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
true
)
end
include_examples
'namespace minutes quota'
end
context
'with ci_queu
eing_denormalize_shared_runners_information
disabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
disabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_shared_runners_information
:
false
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
false
)
end
around
do
|
example
|
...
...
spec/services/ci/register_job_service_spec.rb
View file @
78556e3f
...
...
@@ -740,17 +740,17 @@ module Ci
stub_feature_flags
(
ci_pending_builds_queue_source:
true
)
end
context
'with ci_queu
eing_denormalize_shared_runners_information
enabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
enabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_shared_runners_information
:
true
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
true
)
end
include_examples
'handles runner assignment'
end
context
'with ci_queu
eing_denormalize_shared_runners_information
disabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
disabled'
do
before
do
stub_feature_flags
(
ci_queu
eing_denormalize_shared_runners_information
:
false
)
stub_feature_flags
(
ci_queu
ing_use_denormalized_data_strategy
:
false
)
end
around
do
|
example
|
...
...
@@ -762,37 +762,9 @@ module Ci
include_examples
'handles runner assignment'
end
context
'with ci_queu
eing_denormalize_tags_information
enabled'
do
context
'with ci_queu
ing_use_denormalized_data_strategy
enabled'
do
before
do
stub_feature_flags
(
ci_queueing_denormalize_tags_information:
true
)
end
include_examples
'handles runner assignment'
end
context
'with ci_queueing_denormalize_tags_information disabled'
do
before
do
stub_feature_flags
(
ci_queueing_denormalize_tags_information:
false
)
end
around
do
|
example
|
allow_cross_joins_across_databases
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/332952'
)
do
example
.
run
end
end
include_examples
'handles runner assignment'
end
context
'with ci_queueing_denormalize_namespace_traversal_ids disabled'
do
before
do
stub_feature_flags
(
ci_queueing_denormalize_namespace_traversal_ids:
false
)
end
around
do
|
example
|
allow_cross_joins_across_databases
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/332952'
)
do
example
.
run
end
stub_feature_flags
(
ci_queuing_use_denormalized_data_strategy:
true
)
end
include_examples
'handles runner assignment'
...
...
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