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
bed2cfac
Commit
bed2cfac
authored
Jul 13, 2021
by
Avielle Wolfe
Committed by
Fabio Pitino
Jul 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add #force_cost_factor? method to Project
parent
c117b51b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
0 deletions
+78
-0
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+7
-0
ee/config/feature_flags/development/ci_minutes_public_project_cost_factor.yml
...ags/development/ci_minutes_public_project_cost_factor.yml
+8
-0
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+63
-0
No files found.
ee/app/models/ee/project.rb
View file @
bed2cfac
...
...
@@ -13,6 +13,7 @@ module EE
include
IgnorableColumns
GIT_LFS_DOWNLOAD_OPERATION
=
'download'
PUBLIC_COST_FACTOR_RELEASE_DAY
=
Date
.
new
(
2021
,
7
,
17
).
freeze
prepended
do
include
Elastic
::
ProjectsSearch
...
...
@@ -827,6 +828,12 @@ module EE
ci_cd_settings
.
auto_rollback_enabled?
end
def
force_cost_factor?
::
Gitlab
.
com?
&&
public
?
&&
::
Feature
.
enabled?
(
:ci_minutes_public_project_cost_factor
,
self
,
default_enabled:
:
yaml
)
&&
namespace
.
created_at
>=
PUBLIC_COST_FACTOR_RELEASE_DAY
end
private
def
github_integration_enabled?
...
...
ee/config/feature_flags/development/ci_minutes_public_project_cost_factor.yml
0 → 100644
View file @
bed2cfac
---
name
:
ci_minutes_public_project_cost_factor
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65155
rollout_issue_url
:
milestone
:
'
14.1'
type
:
development
group
:
group::pipeline execution
default_enabled
:
true
ee/spec/models/project_spec.rb
View file @
bed2cfac
...
...
@@ -2947,4 +2947,67 @@ RSpec.describe Project do
end
end
end
describe
'#force_cost_factor?'
do
context
'on gitlab.com'
do
context
'when public'
do
context
'when ci_minutes_public_project_cost_factor is enabled'
do
context
'when in a namespace created after 17 July, 2021'
do
it
'returns true'
do
stub_feature_flags
(
ci_minutes_public_project_cost_factor:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
namespace
=
build
(
:group
,
created_at:
Date
.
new
(
2021
,
7
,
17
))
project
=
build
(
:project
,
:public
,
namespace:
namespace
)
expect
(
project
.
force_cost_factor?
).
to
be_truthy
end
end
context
'when in a namespace created before 17 July, 2021'
do
it
'returns false'
do
stub_feature_flags
(
ci_minutes_public_project_cost_factor:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
namespace
=
build
(
:group
,
created_at:
Date
.
new
(
2021
,
7
,
16
))
project
=
build
(
:project
,
:public
,
namespace:
namespace
)
expect
(
project
.
force_cost_factor?
).
to
be_falsy
end
end
end
context
'when ci_minutes_public_project_cost_factor is disabled'
do
it
'returns false'
do
stub_feature_flags
(
ci_minutes_public_project_cost_factor:
false
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
namespace
=
build
(
:group
,
created_at:
Date
.
new
(
2021
,
7
,
16
))
project
=
build
(
:project
,
:public
,
namespace:
namespace
)
expect
(
project
.
force_cost_factor?
).
to
be_falsy
end
end
end
context
'when not public'
do
it
'returns false'
do
stub_feature_flags
(
ci_minutes_public_project_cost_factor:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
namespace
=
build
(
:group
,
created_at:
Date
.
new
(
2021
,
7
,
17
))
project
=
build
(
:project
,
:private
,
namespace:
namespace
)
expect
(
project
.
force_cost_factor?
).
to
be_falsy
end
end
end
context
'when not on gitlab.com'
do
it
'returns false'
do
stub_feature_flags
(
ci_minutes_public_project_cost_factor:
true
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
namespace
=
build
(
:group
,
created_at:
Date
.
new
(
2021
,
7
,
17
))
project
=
build
(
:project
,
:public
,
namespace:
namespace
)
expect
(
project
.
force_cost_factor?
).
to
be_falsy
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