Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
28a9f32a5e
commit
69d7f138e4
|
|
@ -1 +1 @@
|
|||
351ea2b5585c837394a616f08fa16bdbb28808aa
|
||||
6250b300df6b3559e377ac6d218bba674ee045bf
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ export default {
|
|||
</div>
|
||||
<div class="gl-mt-2">{{ item.sourceName }}</div>
|
||||
<div class="gl-mt-2 gl-flex gl-gap-1">
|
||||
<span v-if="item.sourceUsername && item.sourceName">@{{ item.sourceUsername }}</span>
|
||||
<span v-if="item.sourceUsername">@{{ item.sourceUsername }}</span>
|
||||
<template v-else>
|
||||
<help-popover
|
||||
:aria-label="s__('UserMapping|Full user details missing')"
|
||||
|
|
|
|||
|
|
@ -233,7 +233,8 @@ module Namespaces
|
|||
return if is_a?(Namespaces::ProjectNamespace)
|
||||
|
||||
self.transient_traversal_ids = if parent_id
|
||||
parent.traversal_ids + [id]
|
||||
# remove safe navigation and `.to_a` with https://gitlab.com/gitlab-org/gitlab/-/issues/508611
|
||||
parent&.traversal_ids.to_a + [id]
|
||||
else
|
||||
[id]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ module Groups
|
|||
event = Groups::GroupDeletedEvent.new(
|
||||
data: {
|
||||
group_id: group.id,
|
||||
root_namespace_id: group.root_ancestor.id
|
||||
root_namespace_id: group.root_ancestor&.id.to_i # remove safe navigation and `.to_i` with https://gitlab.com/gitlab-org/gitlab/-/issues/508611
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/165855
|
|||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/tbd
|
||||
milestone: '17.7'
|
||||
group: group::import and integrate
|
||||
type: wip
|
||||
type: beta
|
||||
default_enabled: false
|
||||
|
|
@ -5,5 +5,5 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167078
|
|||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/498390
|
||||
milestone: '17.6'
|
||||
group: group::import and integrate
|
||||
type: wip
|
||||
type: beta
|
||||
default_enabled: false
|
||||
|
|
@ -5,5 +5,5 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169726
|
|||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/499993
|
||||
milestone: '17.6'
|
||||
group: group::import and integrate
|
||||
type: wip
|
||||
type: beta
|
||||
default_enabled: false
|
||||
|
|
@ -4,5 +4,5 @@ description: Deletes orhpaned groups whose parent's does not exist
|
|||
feature_category: groups_and_projects
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/172420
|
||||
milestone: '17.7'
|
||||
queued_migration_version: 20241112163029
|
||||
queued_migration_version: 20241206154945
|
||||
finalized_by: # version of the migration that finalized this BBM
|
||||
|
|
|
|||
|
|
@ -10,19 +10,12 @@ class QueueDeleteOrphanedGroups < Gitlab::Database::Migration[2.2]
|
|||
SUB_BATCH_SIZE = 100
|
||||
|
||||
def up
|
||||
return unless Gitlab.com_except_jh? && !Gitlab.staging?
|
||||
|
||||
queue_batched_background_migration(
|
||||
MIGRATION,
|
||||
:namespaces,
|
||||
:id,
|
||||
job_interval: DELAY_INTERVAL,
|
||||
batch_size: BATCH_SIZE,
|
||||
sub_batch_size: SUB_BATCH_SIZE
|
||||
)
|
||||
# no-op because there was a bug in the original migration, which has been
|
||||
# fixed by https://gitlab.com/gitlab-org/gitlab/-/merge_requests/174995
|
||||
end
|
||||
|
||||
def down
|
||||
delete_batched_background_migration(MIGRATION, :namespaces, :id, [])
|
||||
# no-op because there was a bug in the original migration, which has been
|
||||
# fixed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/174995
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class QueueRequeueDeleteOrphanedGroups < Gitlab::Database::Migration[2.2]
|
||||
milestone '17.7'
|
||||
restrict_gitlab_migration gitlab_schema: :gitlab_main
|
||||
|
||||
MIGRATION = "DeleteOrphanedGroups"
|
||||
DELAY_INTERVAL = 2.minutes
|
||||
BATCH_SIZE = 1000
|
||||
SUB_BATCH_SIZE = 100
|
||||
|
||||
def up
|
||||
return unless Gitlab.com_except_jh? && !Gitlab.staging?
|
||||
|
||||
# Clear previous background migration execution from QueueDeleteOrphanedGroups
|
||||
delete_batched_background_migration(MIGRATION, :namespaces, :id, [])
|
||||
|
||||
queue_batched_background_migration(
|
||||
MIGRATION,
|
||||
:namespaces,
|
||||
:id,
|
||||
job_interval: DELAY_INTERVAL,
|
||||
batch_size: BATCH_SIZE,
|
||||
sub_batch_size: SUB_BATCH_SIZE
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
delete_batched_background_migration(MIGRATION, :namespaces, :id, [])
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
276b46068ee45bbafbe5c51cf466cf2cee0ec0c08d273899ccba3b5e05c93f1d
|
||||
|
|
@ -29,7 +29,7 @@ To view logs associated to the [email stage](../security/identity_verification.m
|
|||
- Query the GitLab production logs with the following KQL:
|
||||
|
||||
```plaintext
|
||||
KQL: json.controller:"RegistrationsIdentityVerificationController" AND json.username:replace_username_here
|
||||
json.controller:"RegistrationsIdentityVerificationController" AND json.username:replace_username_here
|
||||
```
|
||||
|
||||
Valuable debugging information can be found in the `json.action` and `json.location` columns.
|
||||
|
|
@ -41,7 +41,7 @@ To view logs associated to the [phone stage](../security/identity_verification.m
|
|||
- Query the GitLab production logs with the following KQL:
|
||||
|
||||
```plaintext
|
||||
KQL: json.message: "IdentityVerification::Phone" AND json.username:replace_username_here
|
||||
json.message: "IdentityVerification::Phone" AND json.username:replace_username_here
|
||||
```
|
||||
|
||||
On rows where `json.event` is `Failed Attempt`, you can find valuable debugging information in the `json.reason` column such as:
|
||||
|
|
@ -76,7 +76,7 @@ To view logs associated to the [credit card stage](../security/identity_verifica
|
|||
- Query the GitLab production logs with the following KQL:
|
||||
|
||||
```plaintext
|
||||
KQL: json.message: "IdentityVerification::CreditCard" AND json.username:replace_username_here
|
||||
json.message: "IdentityVerification::CreditCard" AND json.username:replace_username_here
|
||||
```
|
||||
|
||||
On rows where `json.event` is `Failed Attempt`, you can find valuable debugging information in the `json.reason` column such as:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Gitlab
|
|||
.joins("LEFT JOIN namespaces AS parent ON namespaces.parent_id = parent.id")
|
||||
.where(parent: { id: nil })
|
||||
.pluck(:id).each do |orphaned_group_id|
|
||||
::GroupDestroyWorker.perform(orphaned_group_id, admin_bot.id)
|
||||
::GroupDestroyWorker.perform_async(orphaned_group_id, admin_bot.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ module Gitlab
|
|||
def group_data
|
||||
parent = group.parent
|
||||
|
||||
return super unless parent
|
||||
|
||||
super.merge(
|
||||
parent_group_id: parent.id,
|
||||
parent_name: parent.name,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ module Sidebars
|
|||
:vulnerability_report,
|
||||
:dependency_list,
|
||||
:audit_events,
|
||||
:compliance,
|
||||
:scan_policies,
|
||||
:on_demand_scans,
|
||||
:configuration
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedGroups, feature_category: :groups_and_projects do
|
||||
let(:organization) { table(:organizations).create!(name: 'organization', path: 'organization') }
|
||||
let(:namespaces) { table(:namespaces) }
|
||||
let!(:parent) { namespaces.create!(name: 'Group', type: 'Group', path: 'space1', organization_id: organization.id) }
|
||||
let!(:group) { namespaces.create!(name: 'GitLab', type: 'Group', path: 'group1', organization_id: organization.id) }
|
||||
let!(:parent) { namespaces.create!(name: 'Group', type: 'Group', path: 'space1') }
|
||||
let!(:group) { namespaces.create!(name: 'GitLab', type: 'Group', path: 'group1') }
|
||||
let!(:admin_bot) { ::Users::Internal.admin_bot }
|
||||
let!(:orphaned_groups) do
|
||||
(1..4).map do |i|
|
||||
namespaces.create!(name: "Group #{i}", path: "orphaned_group_#{i}", type: 'Group', parent_id: parent.id)
|
||||
end
|
||||
end
|
||||
|
||||
subject(:background_migration) do
|
||||
described_class.new(
|
||||
|
|
@ -24,6 +29,7 @@ RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedGroups, feature_catego
|
|||
before do
|
||||
# Remove constraint so we can create invalid records
|
||||
ApplicationRecord.connection.execute("ALTER TABLE namespaces DROP CONSTRAINT fk_7f813d8c90;")
|
||||
(1..4).map { |i| namespaces.create!(name: "Group #{i}", path: "group_#{i}", type: 'Group', parent_id: group.id) }
|
||||
end
|
||||
|
||||
after do
|
||||
|
|
@ -34,26 +40,11 @@ RSpec.describe Gitlab::BackgroundMigration::DeleteOrphanedGroups, feature_catego
|
|||
SQL
|
||||
end
|
||||
|
||||
it 'enqueues ::GroupDestroyWorker for each group whose parent\'s do not exist' do
|
||||
orphaned_groups = (1..4).map do |i|
|
||||
namespaces.create!(name: "Group #{i}", path: "orphaned_group_#{i}", type: 'Group', parent_id: parent.id,
|
||||
organization_id: organization.id)
|
||||
end
|
||||
groups = (1..4).map do |i|
|
||||
namespaces.create!(name: "Group #{i}", path: "group_#{i}", type: 'Group', parent_id: group.id,
|
||||
organization_id: organization.id)
|
||||
end
|
||||
it 'enqueues ::GroupDestroyWorker for each group whose parent\'s do not exist and destroys them', :sidekiq_inline do
|
||||
parent.destroy!
|
||||
|
||||
orphaned_groups.each do |group|
|
||||
expect(::GroupDestroyWorker).to receive(:perform).with(group.id, ::Users::Internal.admin_bot.id)
|
||||
end
|
||||
|
||||
groups.each do |group|
|
||||
expect(::GroupDestroyWorker).not_to receive(:perform).with(group.id, ::Users::Internal.admin_bot.id)
|
||||
end
|
||||
|
||||
background_migration
|
||||
expect { background_migration }.to change { namespaces.count }.from(10).to(6)
|
||||
.and change { namespaces.where(id: orphaned_groups.pluck(:id)).count }.from(4).to(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ RSpec.describe Sidebars::Projects::SuperSidebarMenus::SecureMenu, feature_catego
|
|||
:vulnerability_report,
|
||||
:dependency_list,
|
||||
:audit_events,
|
||||
:compliance,
|
||||
:scan_policies,
|
||||
:on_demand_scans,
|
||||
:configuration
|
||||
|
|
|
|||
|
|
@ -8,42 +8,8 @@ RSpec.describe QueueDeleteOrphanedGroups, migration: :gitlab_main, feature_categ
|
|||
|
||||
it 'does not schedule a new batched migration' do
|
||||
reversible_migration do |migration|
|
||||
migration.before -> {
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
}
|
||||
|
||||
migration.after -> {
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when executed on .com' do
|
||||
before do
|
||||
allow(Gitlab).to receive(:com_except_jh?).and_return(true)
|
||||
end
|
||||
|
||||
describe '#up' do
|
||||
it 'schedules background migration' do
|
||||
migrate!
|
||||
|
||||
expect(batched_migration).to have_scheduled_batched_migration(
|
||||
table_name: :namespaces,
|
||||
column_name: :id,
|
||||
interval: described_class::DELAY_INTERVAL,
|
||||
batch_size: described_class::BATCH_SIZE,
|
||||
sub_batch_size: described_class::SUB_BATCH_SIZE
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#down' do
|
||||
it 'removes scheduled background migrations' do
|
||||
migrate!
|
||||
schema_migrate_down!
|
||||
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
end
|
||||
migration.before -> { expect(batched_migration).not_to have_scheduled_batched_migration }
|
||||
migration.after -> { expect(batched_migration).not_to have_scheduled_batched_migration }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require_migration!
|
||||
|
||||
RSpec.describe QueueRequeueDeleteOrphanedGroups, migration: :gitlab_main, feature_category: :groups_and_projects do
|
||||
let!(:batched_migration) { described_class::MIGRATION }
|
||||
|
||||
it 'does not schedule a new batched migration' do
|
||||
reversible_migration do |migration|
|
||||
migration.before -> {
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
}
|
||||
|
||||
migration.after -> {
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context 'when executed on .com' do
|
||||
before do
|
||||
allow(Gitlab).to receive(:com_except_jh?).and_return(true)
|
||||
end
|
||||
|
||||
describe '#up' do
|
||||
it 'schedules background migration' do
|
||||
migrate!
|
||||
|
||||
expect(batched_migration).to have_scheduled_batched_migration(
|
||||
table_name: :namespaces,
|
||||
column_name: :id,
|
||||
interval: described_class::DELAY_INTERVAL,
|
||||
batch_size: described_class::BATCH_SIZE,
|
||||
sub_batch_size: described_class::SUB_BATCH_SIZE
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#down' do
|
||||
it 'removes scheduled background migrations' do
|
||||
migrate!
|
||||
schema_migrate_down!
|
||||
|
||||
expect(batched_migration).not_to have_scheduled_batched_migration
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue