From 00a46ce6b45ba7f370fbd50c80db211f7a44edee Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 23 Oct 2024 03:15:27 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/models/abuse_report.rb | 1 - app/models/alert_management/alert.rb | 1 - app/models/application_record.rb | 1 + app/models/application_setting.rb | 1 - .../batched_git_ref_updates/deletion.rb | 1 - app/models/ci/catalog/resources/component.rb | 1 - app/models/ci/catalog/resources/sync_event.rb | 1 - .../ci/finished_pipeline_ch_sync_event.rb | 1 - app/models/ci/job_artifact.rb | 1 - app/models/ci/runner.rb | 1 - app/models/clusters/agent.rb | 1 - .../packages/debian/component_file.rb | 1 - app/models/diff_note.rb | 2 +- app/models/issue.rb | 1 - .../loose_foreign_keys/deleted_record.rb | 1 - app/models/member.rb | 1 - app/models/namespace.rb | 1 - app/models/namespace_setting.rb | 1 - app/models/note.rb | 2 +- app/models/packages/conan/metadatum.rb | 2 - app/models/plan_limits.rb | 1 - app/models/project.rb | 7 +- app/models/project_feature_usage.rb | 1 - app/models/project_setting.rb | 1 - app/models/project_statistics.rb | 1 - app/models/protected_branch/cache_key.rb | 14 +--- app/models/user_detail.rb | 1 - app/models/users/credit_card_validation.rb | 2 - app/models/users/phone_number_validation.rb | 2 - .../development/group_protected_branches.yml | 8 --- .../prompt_migration_generate_description.yml | 9 +++ .../prompt_migration_summarize_review.yml} | 12 ++-- .../subscription_user_add_on_assignments.yml | 12 +--- ...on_assignments_organization_id_not_null.rb | 14 ++++ db/schema_migrations/20241022170157 | 1 + db/structure.sql | 3 +- doc/api/group_protected_branches.md | 5 +- doc/ci/variables/predefined_variables.md | 3 - doc/development/ai_features/index.md | 4 +- .../configure-dev-env-gdk-in-a-box.md | 2 +- .../avoiding_downtime_in_migrations.md | 3 - doc/security/ssh_keys_restrictions.md | 2 +- .../vulnerabilities/index.md | 2 +- .../project/repository/branches/protected.md | 7 +- ...ll_integrations_enable_ssl_verification.rb | 2 - lib/gitlab/database/shared_model.rb | 2 + lib/gitlab/tracking/event_definition.rb | 9 ++- .../usage_data_counters/hll_redis_counter.rb | 2 +- rubocop/cop/ignored_columns.rb | 2 - .../query_builder_spec.rb | 2 - .../strategies/record_loader_strategy_spec.rb | 2 - .../gitlab/pagination/keyset/order_spec.rb | 1 - spec/models/application_record_spec.rb | 1 - .../models/concerns/ignorable_columns_spec.rb | 6 +- spec/models/project_spec.rb | 20 +----- .../models/protected_branch/cache_key_spec.rb | 18 ----- spec/models/protected_branch_spec.rb | 67 ++++++------------- .../protect_default_branch_service_spec.rb | 20 +----- .../protected_branches/cache_service_spec.rb | 12 +--- 59 files changed, 82 insertions(+), 224 deletions(-) delete mode 100644 config/feature_flags/development/group_protected_branches.yml create mode 100644 config/feature_flags/experiment/prompt_migration_generate_description.yml rename config/feature_flags/{beta/ai_gateway_agents.yml => experiment/prompt_migration_summarize_review.yml} (69%) create mode 100644 db/post_migrate/20241022170157_add_subscription_user_add_on_assignments_organization_id_not_null.rb create mode 100644 db/schema_migrations/20241022170157 diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 45716022006..be6bd9535d0 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -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' diff --git a/app/models/alert_management/alert.rb b/app/models/alert_management/alert.rb index 8726f1013f1..a73dc05fdf4 100644 --- a/app/models/alert_management/alert.rb +++ b/app/models/alert_management/alert.rb @@ -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' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 5faa3b2dcc1..70b60743bae 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -10,6 +10,7 @@ class ApplicationRecord < ActiveRecord::Base include Gitlab::SensitiveSerializableHash include ResetOnColumnErrors include HasCheckConstraints + include IgnorableColumns self.abstract_class = true diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index ab5979a7abf..ddb0a105dc4 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -5,7 +5,6 @@ class ApplicationSetting < ApplicationRecord include CacheMarkdownField include TokenAuthenticatable include ChronicDurationAttribute - include IgnorableColumns include Sanitizable ignore_columns %i[ diff --git a/app/models/batched_git_ref_updates/deletion.rb b/app/models/batched_git_ref_updates/deletion.rb index fdab19e6f78..9367cee5903 100644 --- a/app/models/batched_git_ref_updates/deletion.rb +++ b/app/models/batched_git_ref_updates/deletion.rb @@ -4,7 +4,6 @@ module BatchedGitRefUpdates class Deletion < ApplicationRecord PARTITION_DURATION = 1.day - include IgnorableColumns include BulkInsertSafe include PartitionedTable include EachBatch diff --git a/app/models/ci/catalog/resources/component.rb b/app/models/ci/catalog/resources/component.rb index 0cfd9bb928e..0739f2fe225 100644 --- a/app/models/ci/catalog/resources/component.rb +++ b/app/models/ci/catalog/resources/component.rb @@ -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' diff --git a/app/models/ci/catalog/resources/sync_event.rb b/app/models/ci/catalog/resources/sync_event.rb index 8783d023023..6366e20dbf7 100644 --- a/app/models/ci/catalog/resources/sync_event.rb +++ b/app/models/ci/catalog/resources/sync_event.rb @@ -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 diff --git a/app/models/ci/finished_pipeline_ch_sync_event.rb b/app/models/ci/finished_pipeline_ch_sync_event.rb index 3187da45d6d..0025406f07e 100644 --- a/app/models/ci/finished_pipeline_ch_sync_event.rb +++ b/app/models/ci/finished_pipeline_ch_sync_event.rb @@ -4,7 +4,6 @@ module Ci class FinishedPipelineChSyncEvent < Ci::ApplicationRecord include EachBatch include FromUnion - include IgnorableColumns include PartitionedTable PARTITION_DURATION = 1.day diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index f641a0b7663..f50468c1678 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -3,7 +3,6 @@ module Ci class JobArtifact < Ci::ApplicationRecord include Ci::Partitionable - include IgnorableColumns include AfterCommitQueue include UpdateProjectStatistics include UsageStatistics diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 2b0b389a860..2e118e95fe2 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -13,7 +13,6 @@ module Ci include TaggableQueries include Presentable include EachBatch - include IgnorableColumns include Ci::HasRunnerExecutor include Ci::HasRunnerStatus include Ci::Taggable diff --git a/app/models/clusters/agent.rb b/app/models/clusters/agent.rb index e7a813c3cf2..f0300f33cf5 100644 --- a/app/models/clusters/agent.rb +++ b/app/models/clusters/agent.rb @@ -4,7 +4,6 @@ module Clusters class Agent < ApplicationRecord include FromUnion include Gitlab::Utils::StrongMemoize - include IgnorableColumns self.table_name = 'cluster_agents' diff --git a/app/models/concerns/packages/debian/component_file.rb b/app/models/concerns/packages/debian/component_file.rb index 130d1cdcccf..ece9219992e 100644 --- a/app/models/concerns/packages/debian/component_file.rb +++ b/app/models/concerns/packages/debian/component_file.rb @@ -8,7 +8,6 @@ module Packages included do include Sortable include FileStoreMounter - include IgnorableColumns def self.container_foreign_key "#{container_type}_id".to_sym diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index e791f3a70c1..1feb34faccc 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -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 diff --git a/app/models/issue.rb b/app/models/issue.rb index 09ff5e77886..282ee2cedb4 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -24,7 +24,6 @@ class Issue < ApplicationRecord include FromUnion include EachBatch include PgFullTextSearchable - include IgnorableColumns include Gitlab::DueAtFilterable extend ::Gitlab::Utils::Override diff --git a/app/models/loose_foreign_keys/deleted_record.rb b/app/models/loose_foreign_keys/deleted_record.rb index 0b29baa592f..5baa65cb5df 100644 --- a/app/models/loose_foreign_keys/deleted_record.rb +++ b/app/models/loose_foreign_keys/deleted_record.rb @@ -6,7 +6,6 @@ class LooseForeignKeys::DeletedRecord < Gitlab::Database::SharedModel PARTITION_DURATION = 1.day include PartitionedTable - include IgnorableColumns self.primary_key = :id diff --git a/app/models/member.rb b/app/models/member.rb index e7e8fed2c54..758d1fb0ffa 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -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' diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 43afde16e77..55de4fac24b 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -18,7 +18,6 @@ class Namespace < ApplicationRecord include Ci::NamespaceSettings include Referable include CrossDatabaseIgnoredTables - include IgnorableColumns include UseSqlFunctionForPrimaryKeyLookups include Todoable diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb index 79c70b3802c..41c167c427d 100644 --- a/app/models/namespace_setting.rb +++ b/app/models/namespace_setting.rb @@ -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' diff --git a/app/models/note.rb b/app/models/note.rb index 3869499daec..28a9687f01c 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -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 diff --git a/app/models/packages/conan/metadatum.rb b/app/models/packages/conan/metadatum.rb index c9c9a127b08..c239ca85fd5 100644 --- a/app/models/packages/conan/metadatum.rb +++ b/app/models/packages/conan/metadatum.rb @@ -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 = '_' diff --git a/app/models/plan_limits.rb b/app/models/plan_limits.rb index 501b4c64833..4f61a0610c6 100644 --- a/app/models/plan_limits.rb +++ b/app/models/plan_limits.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index 73d8d959b54..9e7afa31f76 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/models/project_feature_usage.rb b/app/models/project_feature_usage.rb index 8f4929640b2..ae4b730259d 100644 --- a/app/models/project_feature_usage.rb +++ b/app/models/project_feature_usage.rb @@ -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 diff --git a/app/models/project_setting.rb b/app/models/project_setting.rb index 91a9c10cd4a..ca3e35cb3d2 100644 --- a/app/models/project_setting.rb +++ b/app/models/project_setting.rb @@ -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 diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index 697888468ef..78b03f91a27 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -2,7 +2,6 @@ class ProjectStatistics < ApplicationRecord include CounterAttribute - include IgnorableColumns belongs_to :project belongs_to :namespace diff --git a/app/models/protected_branch/cache_key.rb b/app/models/protected_branch/cache_key.rb index 65a1da86207..eb7cccef5fe 100644 --- a/app/models/protected_branch/cache_key.rb +++ b/app/models/protected_branch/cache_key.rb @@ -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) diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index 893dc0235ce..01991e881ff 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -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' diff --git a/app/models/users/credit_card_validation.rb b/app/models/users/credit_card_validation.rb index 5f401143ba8..31f368de41c 100644 --- a/app/models/users/credit_card_validation.rb +++ b/app/models/users/credit_card_validation.rb @@ -2,8 +2,6 @@ module Users class CreditCardValidation < ApplicationRecord - include IgnorableColumns - DAILY_VERIFICATION_LIMIT = 5 self.table_name = 'user_credit_card_validations' diff --git a/app/models/users/phone_number_validation.rb b/app/models/users/phone_number_validation.rb index 58210a4173b..698d5467f6c 100644 --- a/app/models/users/phone_number_validation.rb +++ b/app/models/users/phone_number_validation.rb @@ -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. diff --git a/config/feature_flags/development/group_protected_branches.yml b/config/feature_flags/development/group_protected_branches.yml deleted file mode 100644 index 5c1a39a0e3b..00000000000 --- a/config/feature_flags/development/group_protected_branches.yml +++ /dev/null @@ -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 diff --git a/config/feature_flags/experiment/prompt_migration_generate_description.yml b/config/feature_flags/experiment/prompt_migration_generate_description.yml new file mode 100644 index 00000000000..4173152b900 --- /dev/null +++ b/config/feature_flags/experiment/prompt_migration_generate_description.yml @@ -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 diff --git a/config/feature_flags/beta/ai_gateway_agents.yml b/config/feature_flags/experiment/prompt_migration_summarize_review.yml similarity index 69% rename from config/feature_flags/beta/ai_gateway_agents.yml rename to config/feature_flags/experiment/prompt_migration_summarize_review.yml index d0f1f18dbca..3ca929ebc8b 100644 --- a/config/feature_flags/beta/ai_gateway_agents.yml +++ b/config/feature_flags/experiment/prompt_migration_summarize_review.yml @@ -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 diff --git a/db/docs/subscription_user_add_on_assignments.yml b/db/docs/subscription_user_add_on_assignments.yml index 529849ac243..f5bc6bda3a5 100644 --- a/db/docs/subscription_user_add_on_assignments.yml +++ b/db/docs/subscription_user_add_on_assignments.yml @@ -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 diff --git a/db/post_migrate/20241022170157_add_subscription_user_add_on_assignments_organization_id_not_null.rb b/db/post_migrate/20241022170157_add_subscription_user_add_on_assignments_organization_id_not_null.rb new file mode 100644 index 00000000000..844b6f8d823 --- /dev/null +++ b/db/post_migrate/20241022170157_add_subscription_user_add_on_assignments_organization_id_not_null.rb @@ -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 diff --git a/db/schema_migrations/20241022170157 b/db/schema_migrations/20241022170157 new file mode 100644 index 00000000000..69a45c003c0 --- /dev/null +++ b/db/schema_migrations/20241022170157 @@ -0,0 +1 @@ +572ad3ef558012aba27fd95c10cddd052cb1044c2269fc18ded5c0830a04f85d \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5291b99d52e..418f1537e1d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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 diff --git a/doc/api/group_protected_branches.md b/doc/api/group_protected_branches.md index 396c392af9e..0824db5ca4c 100644 --- a/doc/api/group_protected_branches.md +++ b/doc/api/group_protected_branches.md @@ -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. diff --git a/doc/ci/variables/predefined_variables.md b/doc/ci/variables/predefined_variables.md index 25ac7019452..329910ba153 100644 --- a/doc/ci/variables/predefined_variables.md +++ b/doc/ci/variables/predefined_variables.md @@ -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. | diff --git a/doc/development/ai_features/index.md b/doc/development/ai_features/index.md index 5cf1efd461b..16703f7b22e 100644 --- a/doc/development/ai_features/index.md +++ b/doc/development/ai_features/index.md @@ -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. diff --git a/doc/development/contributing/first_contribution/configure-dev-env-gdk-in-a-box.md b/doc/development/contributing/first_contribution/configure-dev-env-gdk-in-a-box.md index f0898e5057b..9b0491e0c94 100644 --- a/doc/development/contributing/first_contribution/configure-dev-env-gdk-in-a-box.md +++ b/doc/development/contributing/first_contribution/configure-dev-env-gdk-in-a-box.md @@ -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). diff --git a/doc/development/database/avoiding_downtime_in_migrations.md b/doc/development/database/avoiding_downtime_in_migrations.md index e60e45684a7..94fae13225f 100644 --- a/doc/development/database/avoiding_downtime_in_migrations.md +++ b/doc/development/database/avoiding_downtime_in_migrations.md @@ -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 ``` diff --git a/doc/security/ssh_keys_restrictions.md b/doc/security/ssh_keys_restrictions.md index ba1f7f28d27..8a474b86629 100644 --- a/doc/security/ssh_keys_restrictions.md +++ b/doc/security/ssh_keys_restrictions.md @@ -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 diff --git a/doc/user/application_security/vulnerabilities/index.md b/doc/user/application_security/vulnerabilities/index.md index eec2ee6bbe4..f4de02806dd 100644 --- a/doc/user/application_security/vulnerabilities/index.md +++ b/doc/user/application_security/vulnerabilities/index.md @@ -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. diff --git a/doc/user/project/repository/branches/protected.md b/doc/user/project/repository/branches/protected.md index 8fb9667f462..358ee5e09f5 100644 --- a/doc/user/project/repository/branches/protected.md +++ b/doc/user/project/repository/branches/protected.md @@ -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. diff --git a/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb b/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb index c8e6841c2ae..ea1076602be 100644 --- a/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb +++ b/lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb @@ -28,8 +28,6 @@ module Gitlab # Define the `Integration` model class Integration < ::ApplicationRecord - include IgnorableColumns - self.table_name = :integrations self.inheritance_column = :_type_disabled diff --git a/lib/gitlab/database/shared_model.rb b/lib/gitlab/database/shared_model.rb index 41c3a27bc5b..238df2d93e4 100644 --- a/lib/gitlab/database/shared_model.rb +++ b/lib/gitlab/database/shared_model.rb @@ -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 diff --git a/lib/gitlab/tracking/event_definition.rb b/lib/gitlab/tracking/event_definition.rb index 4f972125851..2ff838a7317 100644 --- a/lib/gitlab/tracking/event_definition.rb +++ b/lib/gitlab/tracking/event_definition.rb @@ -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 = {}) diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index 6505741e681..8306f65cf13 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -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 diff --git a/rubocop/cop/ignored_columns.rb b/rubocop/cop/ignored_columns.rb index 86ab8df6927..44c8dfe19cc 100644 --- a/rubocop/cop/ignored_columns.rb +++ b/rubocop/cop/ignored_columns.rb @@ -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 diff --git a/spec/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder_spec.rb b/spec/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder_spec.rb index bf0eabdae5c..1a4e6ac1c37 100644 --- a/spec/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder_spec.rb +++ b/spec/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder_spec.rb @@ -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 diff --git a/spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb b/spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb index 33157c2e06e..253251f5a85 100644 --- a/spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb +++ b/spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb @@ -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 diff --git a/spec/lib/gitlab/pagination/keyset/order_spec.rb b/spec/lib/gitlab/pagination/keyset/order_spec.rb index fcb828b5327..7ae1de503bb 100644 --- a/spec/lib/gitlab/pagination/keyset/order_spec.rb +++ b/spec/lib/gitlab/pagination/keyset/order_spec.rb @@ -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' diff --git a/spec/models/application_record_spec.rb b/spec/models/application_record_spec.rb index e9a880bdcea..0d3b4ceabaf 100644 --- a/spec/models/application_record_spec.rb +++ b/spec/models/application_record_spec.rb @@ -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' diff --git a/spec/models/concerns/ignorable_columns_spec.rb b/spec/models/concerns/ignorable_columns_spec.rb index 44dc0bb6da6..77d0e15bec3 100644 --- a/spec/models/concerns/ignorable_columns_spec.rb +++ b/spec/models/concerns/ignorable_columns_spec.rb @@ -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 } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 95d2de2ed5e..f779b2f3baf 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -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 diff --git a/spec/models/protected_branch/cache_key_spec.rb b/spec/models/protected_branch/cache_key_spec.rb index 24861d3db27..c0ff08ff7af 100644 --- a/spec/models/protected_branch/cache_key_spec.rb +++ b/spec/models/protected_branch/cache_key_spec.rb @@ -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 diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 02e917ecb7c..c5233bc155c 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -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 diff --git a/spec/services/projects/protect_default_branch_service_spec.rb b/spec/services/projects/protect_default_branch_service_spec.rb index e62b654db26..231025afa91 100644 --- a/spec/services/projects/protect_default_branch_service_spec.rb +++ b/spec/services/projects/protect_default_branch_service_spec.rb @@ -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 diff --git a/spec/services/protected_branches/cache_service_spec.rb b/spec/services/protected_branches/cache_service_spec.rb index fe7ad44cd1e..bbe3f9b0f5f 100644 --- a/spec/services/protected_branches/cache_service_spec.rb +++ b/spec/services/protected_branches/cache_service_spec.rb @@ -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