Commit 1eac1d13 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove early adopter plan

This plan has been removed from GitLab.com and all users have already
been moved to the free plan
parent 89091c02
...@@ -13,8 +13,7 @@ module EE ...@@ -13,8 +13,7 @@ module EE
NAMESPACE_PLANS_TO_LICENSE_PLANS = { NAMESPACE_PLANS_TO_LICENSE_PLANS = {
::Plan::BRONZE => License::STARTER_PLAN, ::Plan::BRONZE => License::STARTER_PLAN,
::Plan::SILVER => License::PREMIUM_PLAN, ::Plan::SILVER => License::PREMIUM_PLAN,
::Plan::GOLD => License::ULTIMATE_PLAN, ::Plan::GOLD => License::ULTIMATE_PLAN
::Plan::EARLY_ADOPTER => License::EARLY_ADOPTER_PLAN
}.freeze }.freeze
LICENSE_PLANS_TO_NAMESPACE_PLANS = NAMESPACE_PLANS_TO_LICENSE_PLANS.invert.freeze LICENSE_PLANS_TO_NAMESPACE_PLANS = NAMESPACE_PLANS_TO_LICENSE_PLANS.invert.freeze
...@@ -322,10 +321,6 @@ module EE ...@@ -322,10 +321,6 @@ module EE
actual_plan_name == ::Plan::FREE actual_plan_name == ::Plan::FREE
end end
def early_adopter_plan?
actual_plan_name == ::Plan::EARLY_ADOPTER
end
def bronze_plan? def bronze_plan?
actual_plan_name == ::Plan::BRONZE actual_plan_name == ::Plan::BRONZE
end end
......
...@@ -10,16 +10,11 @@ module EE ...@@ -10,16 +10,11 @@ module EE
BRONZE = 'bronze'.freeze BRONZE = 'bronze'.freeze
SILVER = 'silver'.freeze SILVER = 'silver'.freeze
GOLD = 'gold'.freeze GOLD = 'gold'.freeze
EARLY_ADOPTER = 'early_adopter'.freeze
EE_DEFAULT_PLANS = (const_get(:DEFAULT_PLANS, false) + [FREE]).freeze EE_DEFAULT_PLANS = (const_get(:DEFAULT_PLANS, false) + [FREE]).freeze
PAID_HOSTED_PLANS = [BRONZE, SILVER, GOLD].freeze PAID_HOSTED_PLANS = [BRONZE, SILVER, GOLD].freeze
FREE_HOSTED_PLANS = [EARLY_ADOPTER].freeze EE_ALL_PLANS = (EE_DEFAULT_PLANS + PAID_HOSTED_PLANS).freeze
EE_ALL_PLANS = (EE_DEFAULT_PLANS + PAID_HOSTED_PLANS + FREE_HOSTED_PLANS).freeze PLANS_ELIGIBLE_FOR_TRIAL = EE_DEFAULT_PLANS
PLANS_ELIGIBLE_FOR_TRIAL = [*EE_DEFAULT_PLANS, *FREE_HOSTED_PLANS].freeze
# This constant must keep ordered by tier.
ALL_HOSTED_PLANS = (PAID_HOSTED_PLANS + FREE_HOSTED_PLANS).freeze
has_many :hosted_subscriptions, class_name: 'GitlabSubscription', foreign_key: 'hosted_plan_id' has_many :hosted_subscriptions, class_name: 'GitlabSubscription', foreign_key: 'hosted_plan_id'
...@@ -55,7 +50,7 @@ module EE ...@@ -55,7 +50,7 @@ module EE
::Plan ::Plan
.joins(:hosted_subscriptions) .joins(:hosted_subscriptions)
.where(name: ALL_HOSTED_PLANS) .where(name: PAID_HOSTED_PLANS)
.where(gitlab_subscriptions: { namespace_id: namespaces }) .where(gitlab_subscriptions: { namespace_id: namespaces })
.distinct .distinct
end end
......
...@@ -6,7 +6,6 @@ class License < ApplicationRecord ...@@ -6,7 +6,6 @@ class License < ApplicationRecord
STARTER_PLAN = 'starter'.freeze STARTER_PLAN = 'starter'.freeze
PREMIUM_PLAN = 'premium'.freeze PREMIUM_PLAN = 'premium'.freeze
ULTIMATE_PLAN = 'ultimate'.freeze ULTIMATE_PLAN = 'ultimate'.freeze
EARLY_ADOPTER_PLAN = 'early_adopter'.freeze
EES_FEATURES = %i[ EES_FEATURES = %i[
audit_events audit_events
...@@ -149,37 +148,10 @@ class License < ApplicationRecord ...@@ -149,37 +148,10 @@ class License < ApplicationRecord
] ]
EEU_FEATURES.freeze EEU_FEATURES.freeze
# List all features available for early adopters,
# i.e. users that started using GitLab.com before
# the introduction of Bronze, Silver, Gold plans.
# Obs.: Do not extend from other feature constants.
# Early adopters should not earn new features as they're
# introduced.
EARLY_ADOPTER_FEATURES = %i[
audit_events
contribution_analytics
cross_project_pipelines
deploy_board
file_locks
group_webhooks
issuable_default_templates
issue_weights
jenkins_integration
merge_request_approvers
multiple_group_issue_boards
multiple_issue_assignees
protected_refs_for_users
push_rules
related_issues
repository_mirrors
scoped_issue_board
].freeze
FEATURES_BY_PLAN = { FEATURES_BY_PLAN = {
STARTER_PLAN => EES_FEATURES, STARTER_PLAN => EES_FEATURES,
PREMIUM_PLAN => EEP_FEATURES, PREMIUM_PLAN => EEP_FEATURES,
ULTIMATE_PLAN => EEU_FEATURES, ULTIMATE_PLAN => EEU_FEATURES
EARLY_ADOPTER_PLAN => EARLY_ADOPTER_FEATURES
}.freeze }.freeze
PLANS_BY_FEATURE = FEATURES_BY_PLAN.each_with_object({}) do |(plan, features), hash| PLANS_BY_FEATURE = FEATURES_BY_PLAN.each_with_object({}) do |(plan, features), hash|
......
...@@ -126,7 +126,7 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -126,7 +126,7 @@ class UpdateAllMirrorsWorker # rubocop:disable Scalability/IdempotentWorker
.joins(root_namespaces_join) .joins(root_namespaces_join)
.joins('LEFT JOIN gitlab_subscriptions ON gitlab_subscriptions.namespace_id = root_namespaces.id') .joins('LEFT JOIN gitlab_subscriptions ON gitlab_subscriptions.namespace_id = root_namespaces.id')
.joins('LEFT JOIN plans ON plans.id = gitlab_subscriptions.hosted_plan_id') .joins('LEFT JOIN plans ON plans.id = gitlab_subscriptions.hosted_plan_id')
.where(['plans.name IN (?) OR projects.visibility_level = ?', ::Plan::ALL_HOSTED_PLANS, ::Gitlab::VisibilityLevel::PUBLIC]) .where(['plans.name IN (?) OR projects.visibility_level = ?', ::Plan::PAID_HOSTED_PLANS, ::Gitlab::VisibilityLevel::PUBLIC])
end end
relation relation
......
# frozen_string_literal: true # frozen_string_literal: true
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
Plan::ALL_HOSTED_PLANS.each do |plan| Plan::PAID_HOSTED_PLANS.each do |plan|
Plan.create!(name: plan, title: plan.titleize) Plan.create!(name: plan, title: plan.titleize)
print '.' print '.'
......
...@@ -18,7 +18,7 @@ module API ...@@ -18,7 +18,7 @@ module API
end end
params do params do
requires :percentage, type: Integer, values: 0..100 requires :percentage, type: Integer, values: 0..100
requires :plan, type: String, values: Plan::ALL_HOSTED_PLANS requires :plan, type: String, values: Plan::PAID_HOSTED_PLANS
end end
put 'rollout' do put 'rollout' do
ElasticNamespaceRolloutWorker.perform_async(params[:plan], params[:percentage], ElasticNamespaceRolloutWorker::ROLLOUT) # rubocop:disable CodeReuse/Worker ElasticNamespaceRolloutWorker.perform_async(params[:plan], params[:percentage], ElasticNamespaceRolloutWorker::ROLLOUT) # rubocop:disable CodeReuse/Worker
...@@ -35,7 +35,7 @@ module API ...@@ -35,7 +35,7 @@ module API
end end
params do params do
requires :percentage, type: Integer, values: 0..100 requires :percentage, type: Integer, values: 0..100
requires :plan, type: String, values: Plan::ALL_HOSTED_PLANS requires :plan, type: String, values: Plan::PAID_HOSTED_PLANS
end end
put 'rollback' do put 'rollback' do
ElasticNamespaceRolloutWorker.perform_async(params[:plan], params[:percentage], ElasticNamespaceRolloutWorker::ROLLBACK) # rubocop:disable CodeReuse/Worker ElasticNamespaceRolloutWorker.perform_async(params[:plan], params[:percentage], ElasticNamespaceRolloutWorker::ROLLBACK) # rubocop:disable CodeReuse/Worker
......
...@@ -32,10 +32,6 @@ FactoryBot.define do ...@@ -32,10 +32,6 @@ FactoryBot.define do
hosted_plan_id { nil } hosted_plan_id { nil }
end end
trait :early_adopter do
association :hosted_plan, factory: :early_adopter_plan
end
trait :bronze do trait :bronze do
association :hosted_plan, factory: :bronze_plan association :hosted_plan, factory: :bronze_plan
end end
......
...@@ -9,7 +9,7 @@ RSpec.describe GitlabSubscription do ...@@ -9,7 +9,7 @@ RSpec.describe GitlabSubscription do
stub_feature_flags(elasticsearch_index_only_paid_groups: false) stub_feature_flags(elasticsearch_index_only_paid_groups: false)
end end
%i[free_plan bronze_plan silver_plan gold_plan early_adopter_plan].each do |plan| %i[free_plan bronze_plan silver_plan gold_plan].each do |plan|
let_it_be(plan) { create(plan) } let_it_be(plan) { create(plan) }
end end
...@@ -40,14 +40,12 @@ RSpec.describe GitlabSubscription do ...@@ -40,14 +40,12 @@ RSpec.describe GitlabSubscription do
describe '.with_hosted_plan' do describe '.with_hosted_plan' do
let!(:gold_subscription) { create(:gitlab_subscription, hosted_plan: gold_plan) } let!(:gold_subscription) { create(:gitlab_subscription, hosted_plan: gold_plan) }
let!(:silver_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan) } let!(:silver_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan) }
let!(:early_adopter_subscription) { create(:gitlab_subscription, hosted_plan: early_adopter_plan) }
let!(:trial_subscription) { create(:gitlab_subscription, hosted_plan: gold_plan, trial: true) } let!(:trial_subscription) { create(:gitlab_subscription, hosted_plan: gold_plan, trial: true) }
it 'scopes to the plan' do it 'scopes to the plan' do
expect(described_class.with_hosted_plan('gold')).to contain_exactly(gold_subscription) expect(described_class.with_hosted_plan('gold')).to contain_exactly(gold_subscription)
expect(described_class.with_hosted_plan('silver')).to contain_exactly(silver_subscription) expect(described_class.with_hosted_plan('silver')).to contain_exactly(silver_subscription)
expect(described_class.with_hosted_plan('early_adopter')).to contain_exactly(early_adopter_subscription)
expect(described_class.with_hosted_plan('bronze')).to be_empty expect(described_class.with_hosted_plan('bronze')).to be_empty
end end
end end
...@@ -161,12 +159,6 @@ RSpec.describe GitlabSubscription do ...@@ -161,12 +159,6 @@ RSpec.describe GitlabSubscription do
include_examples 'always returns a total of 0' include_examples 'always returns a total of 0'
end end
context 'with an early adopter plan' do
let(:subscription_attrs) { { hosted_plan: early_adopter_plan } }
include_examples 'always returns a total of 0'
end
context 'with a paid plan' do context 'with a paid plan' do
let(:subscription_attrs) { { hosted_plan: bronze_plan } } let(:subscription_attrs) { { hosted_plan: bronze_plan } }
...@@ -242,7 +234,6 @@ RSpec.describe GitlabSubscription do ...@@ -242,7 +234,6 @@ RSpec.describe GitlabSubscription do
'bronze' | 1 | true | true 'bronze' | 1 | true | true
'bronze' | 1 | false | false 'bronze' | 1 | false | false
'silver' | 1 | true | true 'silver' | 1 | true | true
'early_adopter' | 1 | true | false
end end
with_them do with_them do
......
...@@ -317,11 +317,6 @@ RSpec.describe License do ...@@ -317,11 +317,6 @@ RSpec.describe License do
.to include(:multiple_issue_assignees, :deploy_board, :file_locks) .to include(:multiple_issue_assignees, :deploy_board, :file_locks)
end end
it 'returns features for early adopter plan' do
expect(described_class.features_for_plan('premium'))
.to include(:deploy_board, :file_locks)
end
it 'returns empty array if no features for given plan' do it 'returns empty array if no features for given plan' do
expect(described_class.features_for_plan('bronze')).to eq([]) expect(described_class.features_for_plan('bronze')).to eq([])
end end
...@@ -778,7 +773,6 @@ RSpec.describe License do ...@@ -778,7 +773,6 @@ RSpec.describe License do
nil | false nil | false
described_class::STARTER_PLAN | false described_class::STARTER_PLAN | false
described_class::PREMIUM_PLAN | false described_class::PREMIUM_PLAN | false
described_class::EARLY_ADOPTER_PLAN | false
described_class::ULTIMATE_PLAN | true described_class::ULTIMATE_PLAN | true
end end
......
...@@ -26,6 +26,6 @@ RSpec.describe Plan do ...@@ -26,6 +26,6 @@ RSpec.describe Plan do
describe '::PLANS_ELIGIBLE_FOR_TRIAL' do describe '::PLANS_ELIGIBLE_FOR_TRIAL' do
subject { ::Plan::PLANS_ELIGIBLE_FOR_TRIAL } subject { ::Plan::PLANS_ELIGIBLE_FOR_TRIAL }
it { is_expected.to eq(%w[default free early_adopter]) } it { is_expected.to eq(%w[default free]) }
end end
end end
...@@ -6,7 +6,6 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do ...@@ -6,7 +6,6 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do
subject { described_class.new } subject { described_class.new }
let_it_be(:bronze_plan) { create(:bronze_plan) } let_it_be(:bronze_plan) { create(:bronze_plan) }
let_it_be(:early_adopter_plan) { create(:early_adopter_plan) }
let_it_be(:gitlab_subscription, refind: true) { create(:gitlab_subscription, seats: 1) } let_it_be(:gitlab_subscription, refind: true) { create(:gitlab_subscription, seats: 1) }
let_it_be(:gitlab_subscription_2, refind: true) { create(:gitlab_subscription, seats: 11) } let_it_be(:gitlab_subscription_2, refind: true) { create(:gitlab_subscription, seats: 11) }
...@@ -81,12 +80,6 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do ...@@ -81,12 +80,6 @@ RSpec.describe UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker do
include_examples 'updates only paid plans' include_examples 'updates only paid plans'
end end
context 'with an early adopter plan' do
let(:subscription_attrs) { { hosted_plan: early_adopter_plan } }
include_examples 'updates only paid plans'
end
context 'with a paid plan', :aggregate_failures do context 'with a paid plan', :aggregate_failures do
before do before do
gitlab_subscription.update!(hosted_plan: bronze_plan) gitlab_subscription.update!(hosted_plan: bronze_plan)
......
...@@ -7,7 +7,6 @@ RSpec.describe MoveLimitsFromPlans do ...@@ -7,7 +7,6 @@ RSpec.describe MoveLimitsFromPlans do
let(:plans) { table(:plans) } let(:plans) { table(:plans) }
let(:plan_limits) { table(:plan_limits) } let(:plan_limits) { table(:plan_limits) }
let!(:early_adopter_plan) { plans.create(name: 'early_adopter', title: 'Early adopter', active_pipelines_limit: 10, pipeline_size_limit: 11, active_jobs_limit: 12) }
let!(:gold_plan) { plans.create(name: 'gold', title: 'Gold', active_pipelines_limit: 20, pipeline_size_limit: 21, active_jobs_limit: 22) } let!(:gold_plan) { plans.create(name: 'gold', title: 'Gold', active_pipelines_limit: 20, pipeline_size_limit: 21, active_jobs_limit: 22) }
let!(:silver_plan) { plans.create(name: 'silver', title: 'Silver', active_pipelines_limit: 30, pipeline_size_limit: 31, active_jobs_limit: 32) } let!(:silver_plan) { plans.create(name: 'silver', title: 'Silver', active_pipelines_limit: 30, pipeline_size_limit: 31, active_jobs_limit: 32) }
let!(:bronze_plan) { plans.create(name: 'bronze', title: 'Bronze', active_pipelines_limit: 40, pipeline_size_limit: 41, active_jobs_limit: 42) } let!(:bronze_plan) { plans.create(name: 'bronze', title: 'Bronze', active_pipelines_limit: 40, pipeline_size_limit: 41, active_jobs_limit: 42) }
...@@ -16,7 +15,7 @@ RSpec.describe MoveLimitsFromPlans do ...@@ -16,7 +15,7 @@ RSpec.describe MoveLimitsFromPlans do
describe 'migrate' do describe 'migrate' do
it 'populates plan_limits from all the records in plans' do it 'populates plan_limits from all the records in plans' do
expect { migrate! }.to change { plan_limits.count }.by 6 expect { migrate! }.to change { plan_limits.count }.by 5
end end
it 'copies plan limits and plan.id into to plan_limits table' do it 'copies plan limits and plan.id into to plan_limits table' do
...@@ -24,7 +23,6 @@ RSpec.describe MoveLimitsFromPlans do ...@@ -24,7 +23,6 @@ RSpec.describe MoveLimitsFromPlans do
new_data = plan_limits.pluck(:plan_id, :ci_active_pipelines, :ci_pipeline_size, :ci_active_jobs) new_data = plan_limits.pluck(:plan_id, :ci_active_pipelines, :ci_pipeline_size, :ci_active_jobs)
expected_data = [ expected_data = [
[early_adopter_plan.id, 10, 11, 12],
[gold_plan.id, 20, 21, 22], [gold_plan.id, 20, 21, 22],
[silver_plan.id, 30, 31, 32], [silver_plan.id, 30, 31, 32],
[bronze_plan.id, 40, 41, 42], [bronze_plan.id, 40, 41, 42],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment