Commit e2aced67 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'move-ff-models-to-core' into 'master'

Move Operations Feature Flag Models to Core RUN AS-IF-FOSS

See merge request gitlab-org/gitlab!41022
parents e35b716c c460cb6f
......@@ -741,10 +741,6 @@ Rails/SaveBang:
- 'ee/spec/models/license_spec.rb'
- 'ee/spec/models/merge_request_spec.rb'
- 'ee/spec/models/merge_train_spec.rb'
- 'ee/spec/models/operations/feature_flag_scope_spec.rb'
- 'ee/spec/models/operations/feature_flag_spec.rb'
- 'ee/spec/models/operations/feature_flags/strategy_spec.rb'
- 'ee/spec/models/operations/feature_flags/user_list_spec.rb'
- 'spec/models/packages/package_spec.rb'
- 'ee/spec/models/project_ci_cd_setting_spec.rb'
- 'ee/spec/models/project_services/github_service_spec.rb'
......@@ -1124,6 +1120,10 @@ Rails/SaveBang:
- 'spec/models/namespace_spec.rb'
- 'spec/models/note_spec.rb'
- 'spec/models/notification_setting_spec.rb'
- 'spec/models/operations/feature_flag_scope_spec.rb'
- 'spec/models/operations/feature_flag_spec.rb'
- 'spec/models/operations/feature_flags/strategy_spec.rb'
- 'spec/models/operations/feature_flags/user_list_spec.rb'
- 'spec/models/pages_domain_spec.rb'
- 'spec/models/project_auto_devops_spec.rb'
- 'spec/models/project_feature_spec.rb'
......
......@@ -344,6 +344,10 @@ class Project < ApplicationRecord
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/228637
has_many :product_analytics_events, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :operations_feature_flags, class_name: 'Operations::FeatureFlag'
has_one :operations_feature_flags_client, class_name: 'Operations::FeatureFlagsClient'
has_many :operations_feature_flags_user_lists, class_name: 'Operations::FeatureFlags::UserList'
accepts_nested_attributes_for :variables, allow_destroy: true
accepts_nested_attributes_for :project_feature, update_only: true
accepts_nested_attributes_for :project_setting, update_only: true
......
......@@ -367,6 +367,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post :mark_as_spam
end
end
resources :feature_flags, param: :iid do
resources :feature_flag_issues, only: [:index, :create, :destroy], as: 'issues', path: 'issues'
end
resource :feature_flags_client, only: [] do
post :reset_token
end
resources :feature_flags_user_lists, param: :iid, only: [:new, :edit, :show]
end
# End of the /-/ scope.
......
......@@ -81,10 +81,6 @@ module EE
accepts_nested_attributes_for :software_license_policies, allow_destroy: true
has_many :merge_trains, foreign_key: 'target_project_id', inverse_of: :target_project
has_many :operations_feature_flags, class_name: 'Operations::FeatureFlag'
has_one :operations_feature_flags_client, class_name: 'Operations::FeatureFlagsClient'
has_many :operations_feature_flags_user_lists, class_name: 'Operations::FeatureFlags::UserList'
has_many :project_aliases
has_many :upstream_project_subscriptions, class_name: 'Ci::Subscriptions::Project', foreign_key: :downstream_project_id, inverse_of: :downstream_project
......
......@@ -19,14 +19,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resources :test_cases, only: [:index]
end
resources :feature_flags, param: :iid do
resources :feature_flag_issues, only: [:index, :create, :destroy], as: 'issues', path: 'issues'
end
resource :feature_flags_client, only: [] do
post :reset_token
end
resources :feature_flags_user_lists, param: :iid, only: [:new, :edit, :show]
resources :autocomplete_sources, only: [] do
collection do
get 'epics'
......
# frozen_string_literal: true
module EE
module Gitlab
module Regex
extend ActiveSupport::Concern
class_methods do
def feature_flag_regex
/\A[a-z]([-_a-z0-9]*[a-z0-9])?\z/
end
def feature_flag_regex_message
"can contain only lowercase letters, digits, '_' and '-'. " \
"Must start with a letter, and cannot end with '-' or '_'"
end
end
end
end
end
......@@ -292,7 +292,14 @@ module Gitlab
def base64_regex
@base64_regex ||= /(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?/.freeze
end
def feature_flag_regex
/\A[a-z]([-_a-z0-9]*[a-z0-9])?\z/
end
end
Gitlab::Regex.prepend_if_ee('EE::Gitlab::Regex')
def feature_flag_regex_message
"can contain only lowercase letters, digits, '_' and '-'. " \
"Must start with a letter, and cannot end with '-' or '_'"
end
end
end
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