Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
03d68e0c71
commit
00a46ce6b4
|
|
@ -8,7 +8,6 @@ class AbuseReport < ApplicationRecord
|
|||
include Gitlab::Utils::StrongMemoize
|
||||
include Mentionable
|
||||
include Noteable
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :assignee_id, remove_with: '16.9', remove_after: '2024-01-19'
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ module AlertManagement
|
|||
include Gitlab::Utils::StrongMemoize
|
||||
include Referable
|
||||
include ::IncidentManagement::Escalatable
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :prometheus_alert_id, remove_with: '17.6', remove_after: '2024-10-12'
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class ApplicationRecord < ActiveRecord::Base
|
|||
include Gitlab::SensitiveSerializableHash
|
||||
include ResetOnColumnErrors
|
||||
include HasCheckConstraints
|
||||
include IgnorableColumns
|
||||
|
||||
self.abstract_class = true
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ class ApplicationSetting < ApplicationRecord
|
|||
include CacheMarkdownField
|
||||
include TokenAuthenticatable
|
||||
include ChronicDurationAttribute
|
||||
include IgnorableColumns
|
||||
include Sanitizable
|
||||
|
||||
ignore_columns %i[
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ module BatchedGitRefUpdates
|
|||
class Deletion < ApplicationRecord
|
||||
PARTITION_DURATION = 1.day
|
||||
|
||||
include IgnorableColumns
|
||||
include BulkInsertSafe
|
||||
include PartitionedTable
|
||||
include EachBatch
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module Ci
|
|||
# This class represents a CI/CD Catalog resource component.
|
||||
# The data will be used as metadata of a component.
|
||||
class Component < ::ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ignore_column :resource_type, remove_with: '17.8', remove_after: '2024-11-18'
|
||||
|
||||
self.table_name = 'catalog_resource_components'
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ module Ci
|
|||
# (DB function name: `insert_catalog_resource_sync_event`).
|
||||
class SyncEvent < ::ApplicationRecord
|
||||
include PartitionedTable
|
||||
include IgnorableColumns
|
||||
|
||||
PARTITION_DURATION = 1.day
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ module Ci
|
|||
class FinishedPipelineChSyncEvent < Ci::ApplicationRecord
|
||||
include EachBatch
|
||||
include FromUnion
|
||||
include IgnorableColumns
|
||||
include PartitionedTable
|
||||
|
||||
PARTITION_DURATION = 1.day
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
module Ci
|
||||
class JobArtifact < Ci::ApplicationRecord
|
||||
include Ci::Partitionable
|
||||
include IgnorableColumns
|
||||
include AfterCommitQueue
|
||||
include UpdateProjectStatistics
|
||||
include UsageStatistics
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ module Ci
|
|||
include TaggableQueries
|
||||
include Presentable
|
||||
include EachBatch
|
||||
include IgnorableColumns
|
||||
include Ci::HasRunnerExecutor
|
||||
include Ci::HasRunnerStatus
|
||||
include Ci::Taggable
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ module Clusters
|
|||
class Agent < ApplicationRecord
|
||||
include FromUnion
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
include IgnorableColumns
|
||||
|
||||
self.table_name = 'cluster_agents'
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ module Packages
|
|||
included do
|
||||
include Sortable
|
||||
include FileStoreMounter
|
||||
include IgnorableColumns
|
||||
|
||||
def self.container_foreign_key
|
||||
"#{container_type}_id".to_sym
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class DiffNote < Note
|
|||
end
|
||||
|
||||
def keep_around_commits
|
||||
repository.keep_around(*shas, source: self.class.name)
|
||||
repository.keep_around(*shas, source: "#{noteable_type}/#{self.class.name}")
|
||||
end
|
||||
|
||||
def repository
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class Issue < ApplicationRecord
|
|||
include FromUnion
|
||||
include EachBatch
|
||||
include PgFullTextSearchable
|
||||
include IgnorableColumns
|
||||
include Gitlab::DueAtFilterable
|
||||
|
||||
extend ::Gitlab::Utils::Override
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ class LooseForeignKeys::DeletedRecord < Gitlab::Database::SharedModel
|
|||
PARTITION_DURATION = 1.day
|
||||
|
||||
include PartitionedTable
|
||||
include IgnorableColumns
|
||||
|
||||
self.primary_key = :id
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class Member < ApplicationRecord
|
|||
include UpdateHighestRole
|
||||
include RestrictedSignup
|
||||
include Gitlab::Experiment::Dsl
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :last_activity_on, remove_with: '17.8', remove_after: '2024-12-23'
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class Namespace < ApplicationRecord
|
|||
include Ci::NamespaceSettings
|
||||
include Referable
|
||||
include CrossDatabaseIgnoredTables
|
||||
include IgnorableColumns
|
||||
include UseSqlFunctionForPrimaryKeyLookups
|
||||
include Todoable
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ class NamespaceSetting < ApplicationRecord
|
|||
include CascadingNamespaceSettingAttribute
|
||||
include Sanitizable
|
||||
include ChronicDurationAttribute
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :third_party_ai_features_enabled, remove_with: '16.11', remove_after: '2024-04-18'
|
||||
ignore_column :code_suggestions, remove_with: '17.0', remove_after: '2024-05-16'
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ class Note < ApplicationRecord
|
|||
end
|
||||
|
||||
def keep_around_commit
|
||||
project.repository.keep_around(self.commit_id, source: self.class.name)
|
||||
project.repository.keep_around(self.commit_id, source: "#{noteable_type}/#{self.class.name}")
|
||||
end
|
||||
|
||||
def ensure_namespace_id
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Packages::Conan::Metadatum < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_columns %i[os architecture build_type compiler compiler_version compiler_libcxx compiler_cppstd],
|
||||
remove_with: '17.6', remove_after: '2024-10-22'
|
||||
NONE_VALUE = '_'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PlanLimits < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ALLOWED_LIMITS_HISTORY_ATTRIBUTES = %i[notification_limit enforcement_limit storage_size_limit
|
||||
dashboard_limit_enabled_at].freeze
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ class Project < ApplicationRecord
|
|||
include IssueParent
|
||||
include WorkItems::Parent
|
||||
include UpdatedAtFilterable
|
||||
include IgnorableColumns
|
||||
include CrossDatabaseIgnoredTables
|
||||
include UseSqlFunctionForPrimaryKeyLookups
|
||||
include Importable
|
||||
|
|
@ -2975,15 +2974,11 @@ class Project < ApplicationRecord
|
|||
end
|
||||
|
||||
def group_protected_branches
|
||||
return root_namespace.protected_branches if allow_protected_branches_for_group? && root_namespace.is_a?(Group)
|
||||
return root_namespace.protected_branches if root_namespace.is_a?(Group)
|
||||
|
||||
ProtectedBranch.none
|
||||
end
|
||||
|
||||
def allow_protected_branches_for_group?
|
||||
Feature.enabled?(:group_protected_branches, group)
|
||||
end
|
||||
|
||||
def deploy_token_create_url(opts = {})
|
||||
Gitlab::Routing.url_helpers.create_deploy_token_project_settings_repository_path(self, opts)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ProjectFeatureUsage < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ignore_column :jira_dvcs_cloud_last_sync_at, remove_with: '16.9', remove_after: '2024-01-21'
|
||||
|
||||
self.primary_key = :project_id
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
class ProjectSetting < ApplicationRecord
|
||||
include ::Gitlab::Utils::StrongMemoize
|
||||
include EachBatch
|
||||
include IgnorableColumns
|
||||
include CascadingProjectSettingAttribute
|
||||
|
||||
ALLOWED_TARGET_PLATFORMS = %w[ios osx tvos watchos android].freeze
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class ProjectStatistics < ApplicationRecord
|
||||
include CounterAttribute
|
||||
include IgnorableColumns
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :namespace
|
||||
|
|
|
|||
|
|
@ -10,25 +10,13 @@ class ProtectedBranch::CacheKey # rubocop:disable Style/ClassAndModuleChildren -
|
|||
end
|
||||
|
||||
def to_s
|
||||
need_to_scope? ? scoped_key : unscoped_key
|
||||
[CACHE_ROOT_KEY, entity_scope, entity.id].join(':')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :entity
|
||||
|
||||
def need_to_scope?
|
||||
Feature.enabled?(:group_protected_branches, group)
|
||||
end
|
||||
|
||||
def scoped_key
|
||||
[CACHE_ROOT_KEY, entity_scope, entity.id].join(':')
|
||||
end
|
||||
|
||||
def unscoped_key
|
||||
[CACHE_ROOT_KEY, entity.id].join(':')
|
||||
end
|
||||
|
||||
def group
|
||||
return entity if entity.is_a?(Group)
|
||||
return entity.group if entity.is_a?(Project)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UserDetail < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
extend ::Gitlab::Utils::Override
|
||||
|
||||
ignore_column :requires_credit_card_verification, remove_with: '16.1', remove_after: '2023-06-22'
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
module Users
|
||||
class CreditCardValidation < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
|
||||
DAILY_VERIFICATION_LIMIT = 5
|
||||
|
||||
self.table_name = 'user_credit_card_validations'
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
module Users
|
||||
class PhoneNumberValidation < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
|
||||
# SMS send attempts subsequent to the first one will have wait times of 1
|
||||
# min, 3 min, 5 min after each one respectively. Wait time between the fifth
|
||||
# attempt and so on will be 10 minutes.
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: group_protected_branches
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372816
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/383178
|
||||
milestone: '15.7'
|
||||
type: development
|
||||
group: group::source code
|
||||
default_enabled: false
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
name: prompt_migration_generate_description
|
||||
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/152429
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169982
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/500121
|
||||
milestone: '17.6'
|
||||
group: group::ai framework
|
||||
type: experiment
|
||||
default_enabled: false
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
name: ai_gateway_agents
|
||||
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/465858
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157986
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/469606
|
||||
milestone: '17.2'
|
||||
name: prompt_migration_summarize_review
|
||||
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/495131
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169982
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/500123
|
||||
milestone: '17.6'
|
||||
group: group::ai framework
|
||||
type: beta
|
||||
type: experiment
|
||||
default_enabled: false
|
||||
|
|
@ -8,13 +8,5 @@ feature_categories:
|
|||
classes:
|
||||
- GitlabSubscriptions::UserAddOnAssignment
|
||||
gitlab_schema: gitlab_main_cell
|
||||
desired_sharding_key:
|
||||
organization_id:
|
||||
references: organizations
|
||||
backfill_via:
|
||||
parent:
|
||||
foreign_key: add_on_purchase_id
|
||||
table: subscription_add_on_purchases
|
||||
sharding_key: organization_id
|
||||
belongs_to: add_on_purchase
|
||||
desired_sharding_key_migration_job_name: BackfillSubscriptionUserAddOnAssignmentsOrganizationId
|
||||
sharding_key:
|
||||
organization_id: organizations
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddSubscriptionUserAddOnAssignmentsOrganizationIdNotNull < Gitlab::Database::Migration[2.2]
|
||||
milestone '17.6'
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_not_null_constraint :subscription_user_add_on_assignments, :organization_id
|
||||
end
|
||||
|
||||
def down
|
||||
remove_not_null_constraint :subscription_user_add_on_assignments, :organization_id
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
572ad3ef558012aba27fd95c10cddd052cb1044c2269fc18ded5c0830a04f85d
|
||||
|
|
@ -19342,7 +19342,8 @@ CREATE TABLE subscription_user_add_on_assignments (
|
|||
user_id bigint NOT NULL,
|
||||
created_at timestamp with time zone NOT NULL,
|
||||
updated_at timestamp with time zone NOT NULL,
|
||||
organization_id bigint
|
||||
organization_id bigint,
|
||||
CONSTRAINT check_7d21f9cebf CHECK ((organization_id IS NOT NULL))
|
||||
);
|
||||
|
||||
CREATE SEQUENCE subscription_user_add_on_assignments_id_seq
|
||||
|
|
|
|||
|
|
@ -12,10 +12,7 @@ DETAILS:
|
|||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110603) in GitLab 15.9 [with a flag](../administration/feature_flags.md) named `group_protected_branches`. Disabled by default.
|
||||
> - Flag `group_protected_branches` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116779) [flag](../administration/feature_flags.md) to `allow_protected_branches_for_group` GitLab 15.11.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is not available. To make it available, an administrator can [enable the feature flag](../administration/feature_flags.md) named `allow_protected_branches_for_group`.
|
||||
On GitLab.com and GitLab Dedicated, this feature is not available.
|
||||
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/500250) in GitLab 17.6. Feature flag `group_protected_branches` removed.
|
||||
|
||||
Use the Group-level protected branches API to manage protected branch rules.
|
||||
It provides endpoints to list, create, update, and delete protected branch rules that apply to projects within a group.
|
||||
|
|
|
|||
|
|
@ -81,9 +81,6 @@ Predefined variables become available at three different phases of pipeline exec
|
|||
| `CI_HAS_OPEN_REQUIREMENTS` | Pipeline | Only available if the pipeline's project has an open [requirement](../../user/project/requirements/index.md). `true` when available. |
|
||||
| `CI_JOB_ID` | Job-only | The internal ID of the job, unique across all jobs in the GitLab instance. |
|
||||
| `CI_JOB_IMAGE` | Pipeline | The name of the Docker image running the job. |
|
||||
| `CI_JOB_JWT` (Deprecated) | Pipeline | A RS256 JSON web token to authenticate with third party systems that support JWT authentication, for example [HashiCorp's Vault](../secrets/index.md). [Deprecated in GitLab 15.9](../../update/deprecations.md#old-versions-of-json-web-tokens-are-deprecated) and scheduled to be removed in GitLab 17.0. Use [ID tokens](../yaml/index.md#id_tokens) instead. |
|
||||
| `CI_JOB_JWT_V1` (Deprecated) | Pipeline | The same value as `CI_JOB_JWT`. [Deprecated in GitLab 15.9](../../update/deprecations.md#old-versions-of-json-web-tokens-are-deprecated) and scheduled to be removed in GitLab 17.0. Use [ID tokens](../yaml/index.md#id_tokens) instead. |
|
||||
| `CI_JOB_JWT_V2` (Deprecated) | Pipeline | A newly formatted RS256 JSON web token to increase compatibility. Similar to `CI_JOB_JWT`, except the issuer (`iss`) claim is changed from `gitlab.com` to `https://gitlab.com`, `sub` has changed from `job_id` to a string that contains the project path, and an `aud` claim is added. The `aud` field is a constant value. Trusting JWTs in multiple relying parties can lead to [one RP sending a JWT to another one and acting maliciously as a job](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72555#note_769112331). [Deprecated in GitLab 15.9](../../update/deprecations.md#old-versions-of-json-web-tokens-are-deprecated) and scheduled to be removed in GitLab 17.0. Use [ID tokens](../yaml/index.md#id_tokens) instead. |
|
||||
| `CI_JOB_MANUAL` | Pipeline | Only available if the job was started manually. `true` when available. |
|
||||
| `CI_JOB_NAME` | Pipeline | The name of the job. |
|
||||
| `CI_JOB_NAME_SLUG` | Pipeline | `CI_JOB_NAME` in lowercase, shortened to 63 bytes, and with everything except `0-9` and `a-z` replaced with `-`. No leading / trailing `-`. Use in paths. Introduced in GitLab 15.4. |
|
||||
|
|
|
|||
|
|
@ -575,7 +575,9 @@ class AiFeaturesCatalogue
|
|||
}.freeze
|
||||
```
|
||||
|
||||
When the feature flag `ai_gateway_agents` is enabled, the `aigw_service_class` will be used to process the AI action.
|
||||
1. Create `prompt_migration_#{feature_name}` feature flag (e.g `prompt_migration_generate_description`)
|
||||
|
||||
When the feature flag is enabled, the `aigw_service_class` will be used to process the AI action.
|
||||
Once you've validated the correct functioning of your action, you can remove the `aigw_service_class` key and replace
|
||||
the `service_class` with the new `AiGateway::Completions` class to make it the permanent provider.
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ You might need to modify the system configuration (CPU cores and RAM) before sta
|
|||
```
|
||||
|
||||
- Enter your name and email address when prompted.
|
||||
- Add the displayed [SSH key to your profile](https://gitlab.com/-/profile/keys).
|
||||
- Add the displayed [SSH key to your profile](https://gitlab.com/-/user_settings/ssh_keys).
|
||||
|
||||
To learn more about the script, you can examine the
|
||||
[`first_time_setup` code](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/support/gdk-in-a-box/first_time_setup).
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ places. This can be done by defining the columns to ignore. For example, in rele
|
|||
|
||||
```ruby
|
||||
class User < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ignore_column :updated_at, remove_with: '12.7', remove_after: '2019-12-22'
|
||||
end
|
||||
```
|
||||
|
|
@ -184,7 +183,6 @@ This step is similar to [the first step when column is dropped](#ignoring-the-co
|
|||
|
||||
```ruby
|
||||
class User < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ignore_column :updated_at, remove_with: '12.7', remove_after: '2019-12-22'
|
||||
end
|
||||
```
|
||||
|
|
@ -463,7 +461,6 @@ Ignore the new `bigint` columns:
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MergeRequest::Metrics < ApplicationRecord
|
||||
include IgnorableColumns
|
||||
ignore_column :id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
|
||||
end
|
||||
```
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ If a restriction is imposed on any key type, users cannot upload new SSH keys th
|
|||
requirement. Any existing keys that don't meet it are disabled but not removed and users cannot
|
||||
pull or push code using them.
|
||||
|
||||
If you have a restricted key, a warning icon (**{warning-icon}**) is visible to you in the **SSH keys** section of your profile.
|
||||
If you have a restricted key, a warning icon (**{warning}**) is visible to you in the **SSH keys** section of your profile.
|
||||
To learn why that key is restricted, hover over the icon.
|
||||
|
||||
## Default settings
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ To resolve the vulnerability:
|
|||
1. Select **Secure > Vulnerability report**.
|
||||
1. Optional. To remove the default filters, select **Clear** (**{clear}**).
|
||||
1. Above the list of vulnerabilities, select the filter bar.
|
||||
1. In the dropdown list that appears, select **Tool**, then select all the values in the **SAST** category.
|
||||
1. In the dropdown list that appears, select **Activity**, then select **Vulnerability Resolution available** in the **GitLab Duo (AI)** category.
|
||||
1. Select outside the filter field. The vulnerability severity totals and list of matching vulnerabilities are updated.
|
||||
1. Select the SAST vulnerability you want resolved.
|
||||
- A blue icon is shown next to vulnerabilities that support Vulnerability Resolution.
|
||||
|
|
|
|||
|
|
@ -125,12 +125,7 @@ DETAILS:
|
|||
**Offering:** Self-managed
|
||||
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106532) in GitLab 15.9 [with a flag](../../../../administration/feature_flags.md) named `group_protected_branches`. Disabled by default.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is not available.
|
||||
To make it available, an administrator can
|
||||
[enable the feature flag](../../../../administration/feature_flags.md)
|
||||
named `group_protected_branches`. On GitLab Dedicated, this feature is not available.
|
||||
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/500250) in GitLab 17.6. Feature flag `group_protected_branches` removed.
|
||||
|
||||
Group owners can create protected branches for a group. These settings are inherited
|
||||
by all projects in the group and can't be overridden by project settings.
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ module Gitlab
|
|||
|
||||
# Define the `Integration` model
|
||||
class Integration < ::ApplicationRecord
|
||||
include IgnorableColumns
|
||||
|
||||
self.table_name = :integrations
|
||||
self.inheritance_column = :_type_disabled
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ module Gitlab
|
|||
module Database
|
||||
# This abstract class is used for models which need to exist in multiple de-composed databases.
|
||||
class SharedModel < ActiveRecord::Base
|
||||
include IgnorableColumns
|
||||
|
||||
self.abstract_class = true
|
||||
|
||||
# if shared model is used, this allows to limit connections
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def internal_event_exists?(event_name)
|
||||
definitions
|
||||
.any? { |event| event.attributes[:internal_events] && event.action == event_name } ||
|
||||
internal_event_actions.include?(event_name) ||
|
||||
Gitlab::UsageDataCounters::HLLRedisCounter.legacy_event?(event_name)
|
||||
end
|
||||
|
||||
|
|
@ -46,6 +45,12 @@ module Gitlab
|
|||
def load_all_from_path(glob_path)
|
||||
Dir.glob(glob_path).map { |path| load_from_file(path) }
|
||||
end
|
||||
|
||||
def internal_event_actions
|
||||
@internal_event_actions ||= definitions
|
||||
.filter_map { |event| event.action if event.attributes[:internal_events] }
|
||||
.to_set
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(path, opts = {})
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def legacy_events
|
||||
YAML.safe_load(File.read(LEGACY_EVENTS_PATH))
|
||||
YAML.safe_load(File.read(LEGACY_EVENTS_PATH)).to_set
|
||||
end
|
||||
|
||||
strong_memoize_attr :key_overrides
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ module RuboCop
|
|||
#
|
||||
# # good
|
||||
# class User < ApplicationRecord
|
||||
# include IgnorableColumns
|
||||
#
|
||||
# ignore_column :name, remove_after: '2023-05-22', remove_with: '16.0'
|
||||
# ignore_column :full_name, remove_after: '2023-05-22', remove_with: '16.0'
|
||||
# end
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ RSpec.describe Gitlab::Pagination::Keyset::InOperatorOptimization::QueryBuilder,
|
|||
Class.new(ApplicationRecord) do
|
||||
self.table_name = 'issues'
|
||||
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :title, remove_with: '16.4', remove_after: '2023-08-22'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ RSpec.describe Gitlab::Pagination::Keyset::InOperatorOptimization::Strategies::R
|
|||
Class.new(ApplicationRecord) do
|
||||
self.table_name = 'projects'
|
||||
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_column :name, remove_with: '16.4', remove_after: '2023-08-22'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -657,7 +657,6 @@ RSpec.describe Gitlab::Pagination::Keyset::Order do
|
|||
Class.new(ApplicationRecord) do
|
||||
self.table_name = 'users'
|
||||
|
||||
include IgnorableColumns
|
||||
include FromUnion
|
||||
|
||||
ignore_column :username, remove_with: '16.4', remove_after: '2023-08-22'
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@ RSpec.describe ApplicationRecord do
|
|||
context 'with an ignored column' do
|
||||
let(:test_model) do
|
||||
Class.new(ApplicationRecord) do
|
||||
include IgnorableColumns
|
||||
self.table_name = :_test_tests
|
||||
|
||||
ignore_columns :ignore_me, remove_after: '2100-01-01', remove_with: '99.12'
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.describe IgnorableColumns do
|
||||
let(:record_class) do
|
||||
Class.new(ApplicationRecord) do
|
||||
include IgnorableColumns
|
||||
end
|
||||
end
|
||||
let(:record_class) { Class.new(ApplicationRecord) }
|
||||
|
||||
subject { record_class }
|
||||
|
||||
|
|
|
|||
|
|
@ -7866,24 +7866,8 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
|
|||
|
||||
subject { create(:project, group: group) }
|
||||
|
||||
context 'when feature flag `group_protected_branches` enabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: true)
|
||||
end
|
||||
|
||||
it 'return all protected branches' do
|
||||
expect(subject.all_protected_branches).to match_array([group_protected_branch, project_protected_branch])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag `group_protected_branches` disabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: false)
|
||||
end
|
||||
|
||||
it 'return only project-level protected branches' do
|
||||
expect(subject.all_protected_branches).to match_array([project_protected_branch])
|
||||
end
|
||||
it 'return all protected branches' do
|
||||
expect(subject.all_protected_branches).to match_array([group_protected_branch, project_protected_branch])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,6 @@ RSpec.describe ProtectedBranch::CacheKey, feature_category: :source_code_managem
|
|||
describe '#to_s' do
|
||||
subject { cache_key.to_s }
|
||||
|
||||
shared_examples 'group feature flags are disabled' do
|
||||
context 'when feature flags are disabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: false)
|
||||
end
|
||||
|
||||
it 'returns an unscoped key' do
|
||||
is_expected.to eq "cache:gitlab:protected_branch:#{entity.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with entity project' do
|
||||
let(:entity) { project }
|
||||
|
||||
|
|
@ -38,8 +26,6 @@ RSpec.describe ProtectedBranch::CacheKey, feature_category: :source_code_managem
|
|||
is_expected.to eq "cache:gitlab:protected_branch:project:#{project.id}"
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'group feature flags are disabled'
|
||||
end
|
||||
|
||||
context 'with entity group' do
|
||||
|
|
@ -48,8 +34,6 @@ RSpec.describe ProtectedBranch::CacheKey, feature_category: :source_code_managem
|
|||
it 'returns a scoped key' do
|
||||
is_expected.to eq "cache:gitlab:protected_branch:group:#{group.id}"
|
||||
end
|
||||
|
||||
it_behaves_like 'group feature flags are disabled'
|
||||
end
|
||||
|
||||
context 'with an unsupported entity' do
|
||||
|
|
@ -58,8 +42,6 @@ RSpec.describe ProtectedBranch::CacheKey, feature_category: :source_code_managem
|
|||
it 'returns a scoped key' do
|
||||
is_expected.to eq "cache:gitlab:protected_branch:user:#{user.id}"
|
||||
end
|
||||
|
||||
it_behaves_like 'group feature flags are disabled'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -536,61 +536,32 @@ RSpec.describe ProtectedBranch, feature_category: :source_code_management do
|
|||
end
|
||||
|
||||
describe "#allow_force_push?" do
|
||||
context "when feature flag disabled" do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: false)
|
||||
end
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
|
||||
let(:subject_branch) { create(:protected_branch, allow_force_push: allow_force_push, name: "foo") }
|
||||
let(:project) { subject_branch.project }
|
||||
let_it_be(:group) { create(:group) }
|
||||
let_it_be(:project) { create(:project, group: group) }
|
||||
|
||||
context "when the attr allow_force_push is true" do
|
||||
let(:allow_force_push) { true }
|
||||
|
||||
it "returns true" do
|
||||
expect(described_class.allow_force_push?(project, "foo")).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "when the attr allow_force_push is false" do
|
||||
let(:allow_force_push) { false }
|
||||
|
||||
it "returns false" do
|
||||
expect(described_class.allow_force_push?(project, "foo")).to eq(false)
|
||||
end
|
||||
end
|
||||
where(:group_level_value, :project_level_value, :result) do
|
||||
true | false | true
|
||||
false | true | true
|
||||
true | nil | true
|
||||
false | nil | false
|
||||
nil | nil | false
|
||||
end
|
||||
|
||||
context "when feature flag enabled" do
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
with_them do
|
||||
before do
|
||||
unless group_level_value.nil?
|
||||
create(:protected_branch, allow_force_push: group_level_value, name: "foo", project: nil, group: group)
|
||||
end
|
||||
|
||||
let_it_be(:group) { create(:group) }
|
||||
let_it_be(:project) { create(:project, group: group) }
|
||||
|
||||
where(:group_level_value, :project_level_value, :result) do
|
||||
true | false | true
|
||||
false | true | true
|
||||
true | nil | true
|
||||
false | nil | false
|
||||
nil | nil | false
|
||||
unless project_level_value.nil?
|
||||
create(:protected_branch, allow_force_push: project_level_value, name: "foo", project: project)
|
||||
end
|
||||
end
|
||||
|
||||
with_them do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: true)
|
||||
|
||||
unless group_level_value.nil?
|
||||
create(:protected_branch, allow_force_push: group_level_value, name: "foo", project: nil, group: group)
|
||||
end
|
||||
|
||||
unless project_level_value.nil?
|
||||
create(:protected_branch, allow_force_push: project_level_value, name: "foo", project: project)
|
||||
end
|
||||
end
|
||||
|
||||
it "returns result" do
|
||||
expect(described_class.allow_force_push?(project, "foo")).to eq(result)
|
||||
end
|
||||
it "returns result" do
|
||||
expect(described_class.allow_force_push?(project, "foo")).to eq(result)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -260,24 +260,8 @@ RSpec.describe Projects::ProtectDefaultBranchService, feature_category: :source_
|
|||
let_it_be_with_reload(:project) { create(:project, :repository, group: group) }
|
||||
let_it_be(:protected_branch) { create(:protected_branch, project: nil, group: group, name: project.default_branch) }
|
||||
|
||||
context 'when feature flag `group_protected_branches` disabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: false)
|
||||
end
|
||||
|
||||
it 'return false' do
|
||||
expect(service.protected_branch_exists?).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag `group_protected_branches` enabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: true)
|
||||
end
|
||||
|
||||
it 'return true' do
|
||||
expect(service.protected_branch_exists?).to eq(true)
|
||||
end
|
||||
it 'return true' do
|
||||
expect(service.protected_branch_exists?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -153,17 +153,7 @@ RSpec.describe ProtectedBranches::CacheService, :clean_gitlab_redis_cache, featu
|
|||
entity.add_owner(user)
|
||||
end
|
||||
|
||||
context 'when feature flag enabled' do
|
||||
it_behaves_like 'execute with entity'
|
||||
end
|
||||
|
||||
context 'when feature flag disabled' do
|
||||
before do
|
||||
stub_feature_flags(group_protected_branches: false)
|
||||
end
|
||||
|
||||
it_behaves_like 'execute with entity'
|
||||
end
|
||||
it_behaves_like 'execute with entity'
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/RedundantFetchBlock
|
||||
|
|
|
|||
Loading…
Reference in New Issue