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
39f24f09
Commit
39f24f09
authored
Nov 10, 2021
by
Mark Chao
Committed by
Alper Akgun
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid GitlabSubscription generation outside SaaS
parent
e5881afe
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
17 additions
and
31 deletions
+17
-31
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+5
-18
ee/spec/features/admin/groups/admin_changes_plan_spec.rb
ee/spec/features/admin/groups/admin_changes_plan_spec.rb
+1
-1
ee/spec/lib/ee/gitlab/ci/pipeline/chain/validate/after_config_spec.rb
...ee/gitlab/ci/pipeline/chain/validate/after_config_spec.rb
+1
-1
ee/spec/models/ci/subscriptions/project_spec.rb
ee/spec/models/ci/subscriptions/project_spec.rb
+2
-2
ee/spec/models/dast/profile_schedule_spec.rb
ee/spec/models/dast/profile_schedule_spec.rb
+1
-1
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+1
-2
spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb
spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb
+3
-3
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+1
-1
spec/models/ci/pipeline_schedule_spec.rb
spec/models/ci/pipeline_schedule_spec.rb
+1
-1
spec/models/hooks/project_hook_spec.rb
spec/models/hooks/project_hook_spec.rb
+1
-1
No files found.
ee/app/models/ee/namespace.rb
View file @
39f24f09
...
...
@@ -179,13 +179,15 @@ module EE
override
:actual_plan
def
actual_plan
strong_memoize
(
:actual_plan
)
do
next
::
Plan
.
default
unless
::
Gitlab
.
com?
if
parent_id
root_ancestor
.
actual_plan
else
subscription
=
find_or_cre
ate_subscription
hosted_plan_for
(
subscription
)
subscription
=
gitlab_subscription
||
gener
ate_subscription
hosted_plan_for
(
subscription
)
||
::
Plan
.
free
end
end
||
fallback_plan
end
end
def
closest_gitlab_subscription
...
...
@@ -444,14 +446,6 @@ module EE
projects_query
.
with_shared_runners
.
any?
end
def
fallback_plan
if
::
Gitlab
.
com?
::
Plan
.
free
else
::
Plan
.
default
end
end
def
validate_shared_runner_minutes_support
return
if
root?
...
...
@@ -487,13 +481,6 @@ module EE
self
.
file_template_project_id
=
nil
end
def
find_or_create_subscription
# Hosted subscriptions are only available for root groups for now.
return
if
parent_id
gitlab_subscription
||
generate_subscription
end
def
generate_subscription
return
unless
persisted?
return
if
::
Gitlab
::
Database
.
read_only?
...
...
ee/spec/features/admin/groups/admin_changes_plan_spec.rb
View file @
39f24f09
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
'Changes GL.com plan for group'
,
:js
do
RSpec
.
describe
'Changes GL.com plan for group'
,
:js
,
:saas
do
include
WaitForRequests
let!
(
:premium_plan
)
{
create
(
:premium_plan
)
}
...
...
ee/spec/lib/ee/gitlab/ci/pipeline/chain/validate/after_config_spec.rb
View file @
39f24f09
...
...
@@ -23,7 +23,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::AfterConfig do
project
.
add_developer
(
user
)
end
describe
'credit card requirement'
do
describe
'credit card requirement'
,
:saas
do
context
'when user does not have credit card for pipelines in project'
do
before
do
allow
(
user
)
...
...
ee/spec/models/ci/subscriptions/project_spec.rb
View file @
39f24f09
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
RSpec
.
describe
Ci
::
Subscriptions
::
Project
do
let_it_be
(
:upstream_project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:downstream_project
)
{
create
(
:project
)
}
let_it_be
_with_reload
(
:upstream_project
)
{
create
(
:project
,
:public
)
}
let_it_be
_with_reload
(
:downstream_project
)
{
create
(
:project
)
}
describe
'Relations'
do
it
{
is_expected
.
to
belong_to
(
:downstream_project
).
required
}
...
...
ee/spec/models/dast/profile_schedule_spec.rb
View file @
39f24f09
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
Dast
::
ProfileSchedule
,
type: :model
do
let
(
:dast_profile_schedule
)
{
create
(
:dast_profile_schedule
,
project:
project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
_with_reload
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:inactive_dast_profile_schedule
)
{
create
(
:dast_profile_schedule
,
active:
false
,
project:
project
)
}
subject
{
dast_profile_schedule
}
...
...
ee/spec/models/ee/namespace_spec.rb
View file @
39f24f09
...
...
@@ -735,8 +735,7 @@ RSpec.describe Namespace do
it
'generates a subscription and returns default plan'
do
expect
(
namespace
.
actual_plan
).
to
eq
(
Plan
.
default
)
# This should be revisited after https://gitlab.com/gitlab-org/gitlab/-/issues/214434
expect
(
namespace
.
gitlab_subscription
).
to
be_present
expect
(
namespace
.
gitlab_subscription
).
to
be_nil
end
end
...
...
spec/lib/gitlab/ci/pipeline/quota/deployments_spec.rb
View file @
39f24f09
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Ci
::
Pipeline
::
Quota
::
Deployments
do
let_it_be
(
:namespace
)
{
create
(
:namespace
)
}
let_it_be
(
:default_plan
,
reload:
true
)
{
create
(
:default_plan
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let_it_be
_with_refind
(
:namespace
)
{
create
(
:namespace
)
}
let_it_be
_with_reload
(
:default_plan
)
{
create
(
:default_plan
)
}
let_it_be
_with_reload
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let_it_be
(
:plan_limits
)
{
create
(
:plan_limits
,
plan:
default_plan
)
}
let
(
:pipeline
)
{
build_stubbed
(
:ci_pipeline
,
project:
project
)
}
...
...
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
39f24f09
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Ci
::
Pipeline
::
Seed
::
Build
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
_with_reload
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:head_sha
)
{
project
.
repository
.
head_commit
.
id
}
let
(
:pipeline
)
{
build
(
:ci_empty_pipeline
,
project:
project
,
sha:
head_sha
)
}
...
...
spec/models/ci/pipeline_schedule_spec.rb
View file @
39f24f09
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
Ci
::
PipelineSchedule
do
let_it_be
(
:project
)
{
create_default
(
:project
)
}
let_it_be
_with_reload
(
:project
)
{
create_default
(
:project
)
}
subject
{
build
(
:ci_pipeline_schedule
)
}
...
...
spec/models/hooks/project_hook_spec.rb
View file @
39f24f09
...
...
@@ -32,8 +32,8 @@ RSpec.describe ProjectHook do
end
describe
'#rate_limit'
do
let_it_be
(
:hook
)
{
create
(
:project_hook
)
}
let_it_be
(
:plan_limits
)
{
create
(
:plan_limits
,
:default_plan
,
web_hook_calls:
100
)
}
let_it_be
(
:hook
)
{
create
(
:project_hook
)
}
it
'returns the default limit'
do
expect
(
hook
.
rate_limit
).
to
be
(
100
)
...
...
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