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
361914a6
Commit
361914a6
authored
Apr 14, 2020
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make :minutes_cost_factor always return a float
parent
490202ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
ee/app/models/ee/ci/build.rb
ee/app/models/ee/ci/build.rb
+1
-1
ee/app/models/ee/ci/runner.rb
ee/app/models/ee/ci/runner.rb
+4
-4
ee/spec/models/ee/ci/runner_spec.rb
ee/spec/models/ee/ci/runner_spec.rb
+2
-2
No files found.
ee/app/models/ee/ci/build.rb
View file @
361914a6
...
...
@@ -37,7 +37,7 @@ module EE
def
shared_runners_minutes_limit_enabled?
if
::
Feature
.
enabled?
(
:ci_minutes_enforce_quota_for_public_projects
)
project
.
shared_runners_minutes_limit_enabled?
&&
runner
&
.
minutes_cost_factor
(
project
.
visibility_level
)
project
.
shared_runners_minutes_limit_enabled?
&&
runner
&
.
minutes_cost_factor
(
project
.
visibility_level
)
&
.
positive?
else
legacy_shared_runners_minutes_limit_enabled?
end
...
...
ee/app/models/ee/ci/runner.rb
View file @
361914a6
...
...
@@ -10,19 +10,19 @@ module EE
end
def
minutes_cost_factor
(
access_level
)
return
unless
instance_type?
return
0.0
unless
instance_type?
case
access_level
when
::
Gitlab
::
VisibilityLevel
::
PUBLIC
public_projects_minutes_cost_factor
if
public_projects_minutes_cost_factor
&
.
positive?
public_projects_minutes_cost_factor
else
# Gitlab::VisibilityLevel::PRIVATE/INTERNAL
private_projects_minutes_cost_factor
if
private_projects_minutes_cost_factor
&
.
positive?
private_projects_minutes_cost_factor
end
end
def
visibility_levels_without_minutes_quota
::
Gitlab
::
VisibilityLevel
.
options
.
values
.
reject
do
|
visibility_level
|
minutes_cost_factor
(
visibility_level
)
&
.
positive?
minutes_cost_factor
(
visibility_level
).
positive?
end
end
end
...
...
ee/spec/models/ee/ci/runner_spec.rb
View file @
361914a6
...
...
@@ -29,7 +29,7 @@ describe EE::Ci::Runner do
context
"with
#{
level_name
}
"
do
let
(
:visibility_level
)
{
level_value
}
it
{
is_expected
.
to
be_nil
}
it
{
is_expected
.
to
eq
(
0.0
)
}
end
end
end
...
...
@@ -41,7 +41,7 @@ describe EE::Ci::Runner do
context
"with
#{
level_name
}
"
do
let
(
:visibility_level
)
{
level_value
}
it
{
is_expected
.
to
be_nil
}
it
{
is_expected
.
to
eq
(
0.0
)
}
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