Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2025-05-05 12:11:40 +00:00
parent 07b2b96b6b
commit 4635d1cf43
55 changed files with 5200 additions and 130 deletions

View File

@ -1577,7 +1577,6 @@ Layout/LineLength:
- 'ee/spec/serializers/ee/user_serializer_spec.rb'
- 'ee/spec/serializers/environment_entity_spec.rb'
- 'ee/spec/serializers/epic_entity_spec.rb'
- 'ee/spec/serializers/fork_namespace_entity_spec.rb'
- 'ee/spec/serializers/member_entity_spec.rb'
- 'ee/spec/serializers/project_mirror_entity_spec.rb'
- 'ee/spec/serializers/security/license_policy_entity_spec.rb'

View File

@ -379,7 +379,6 @@ RSpec/BeEq:
- 'ee/spec/serializers/epic_note_entity_spec.rb'
- 'ee/spec/serializers/epics/discussion_entity_spec.rb'
- 'ee/spec/serializers/epics/related_epic_entity_spec.rb'
- 'ee/spec/serializers/fork_namespace_entity_spec.rb'
- 'ee/spec/serializers/member_user_entity_spec.rb'
- 'ee/spec/serializers/merge_request_widget_entity_spec.rb'
- 'ee/spec/services/analytics/cycle_analytics/value_streams/create_service_spec.rb'

View File

@ -139,7 +139,6 @@ RSpec/FactoryBot/AvoidCreate:
- 'ee/spec/serializers/epic_entity_spec.rb'
- 'ee/spec/serializers/epic_note_entity_spec.rb'
- 'ee/spec/serializers/epics/related_epic_entity_spec.rb'
- 'ee/spec/serializers/fork_namespace_entity_spec.rb'
- 'ee/spec/serializers/incident_management/escalation_policy_entity_spec.rb'
- 'ee/spec/serializers/incident_management/oncall_schedule_entity_spec.rb'
- 'ee/spec/serializers/integrations/field_entity_spec.rb'

View File

@ -875,7 +875,6 @@ RSpec/FeatureCategory:
- 'ee/spec/serializers/epic_note_entity_spec.rb'
- 'ee/spec/serializers/evidences/build_artifact_entity_spec.rb'
- 'ee/spec/serializers/evidences/evidence_entity_spec.rb'
- 'ee/spec/serializers/fork_namespace_entity_spec.rb'
- 'ee/spec/serializers/group_vulnerability_autocomplete_entity_spec.rb'
- 'ee/spec/serializers/incident_management/escalation_policy_entity_spec.rb'
- 'ee/spec/serializers/incident_management/oncall_schedule_entity_spec.rb'

View File

@ -51,7 +51,6 @@ Style/SymbolProc:
- 'ee/app/helpers/ee/registrations_helper.rb'
- 'ee/app/models/concerns/epic_tree_sorting.rb'
- 'ee/app/models/ee/issue.rb'
- 'ee/app/serializers/ee/fork_namespace_entity.rb'
- 'ee/app/serializers/ee/issue_sidebar_basic_entity.rb'
- 'ee/app/serializers/ee/member_entity.rb'
- 'ee/app/serializers/ee/merge_request_widget_entity.rb'

View File

@ -391,9 +391,9 @@ gem 'gitlab-license', '~> 2.6', feature_category: :shared
gem 'rack-attack', '~> 6.7.0', feature_category: :shared
# Sentry integration
gem 'sentry-ruby', '~> 5.22.0', feature_category: :observability
gem 'sentry-rails', '~> 5.22.0', feature_category: :observability
gem 'sentry-sidekiq', '~> 5.22.0', feature_category: :observability
gem 'sentry-ruby', '~> 5.23.0', feature_category: :observability
gem 'sentry-rails', '~> 5.23.0', feature_category: :observability
gem 'sentry-sidekiq', '~> 5.23.0', feature_category: :observability
# PostgreSQL query parsing
#
@ -557,7 +557,7 @@ group :development, :test do
end
group :development, :test, :danger do
gem 'gitlab-dangerfiles', '~> 4.8.0', require: false, feature_category: :tooling
gem 'gitlab-dangerfiles', '~> 4.9.0', require: false, feature_category: :tooling
end
group :development, :test, :coverage do

View File

@ -220,7 +220,7 @@
{"name":"gitlab","version":"4.19.0","platform":"ruby","checksum":"3f645e3e195dbc24f0834fbf83e8ccfb2056d8e9712b01a640aad418a6949679"},
{"name":"gitlab-chronic","version":"0.10.6","platform":"ruby","checksum":"a244d11a1396d2aac6ae9b2f326adf1605ec1ad20c29f06e8b672047d415a9ac"},
{"name":"gitlab-cloud-connector","version":"1.9.0","platform":"ruby","checksum":"247ce56a7f429228f8f0874844f006bc2927ffc9e3a39964bb6a993c9dbf931c"},
{"name":"gitlab-dangerfiles","version":"4.8.1","platform":"ruby","checksum":"bbad321c9638152a643d27a20b35ba1e2d8eddcc6bdfc4493d7b96e816ecf300"},
{"name":"gitlab-dangerfiles","version":"4.9.1","platform":"ruby","checksum":"296b19d8aca5e4da8d391234914a1c4dfedc29700ddbcd9c554b6ffaa7fdf1b2"},
{"name":"gitlab-experiment","version":"0.9.1","platform":"ruby","checksum":"f230ee742154805a755d5f2539dc44d93cdff08c5bbbb7656018d61f93d01f48"},
{"name":"gitlab-fog-azure-rm","version":"2.2.0","platform":"ruby","checksum":"31aa7c2170f57874053144e7f716ec9e15f32e71ffbd2c56753dce46e2e78ba9"},
{"name":"gitlab-glfm-markdown","version":"0.0.29","platform":"aarch64-linux-gnu","checksum":"b4c12b3f87c27f4397344b58b37bb7db6d635747bb88bc9ffe57664b743b6d7b"},
@ -693,9 +693,9 @@
{"name":"seed-fu","version":"2.3.9","platform":"ruby","checksum":"6d902d12dc1b88a16d487506baacc93b3a92e3671fdd603110d1600d35fbf478"},
{"name":"selenium-webdriver","version":"4.27.0","platform":"ruby","checksum":"8821f4ad60b935cfcdc5954c0a6642d894e936250aece8bf37a6fcbebe5eb6e0"},
{"name":"semver_dialects","version":"3.7.0","platform":"ruby","checksum":"6110b05266f7c8ce7794869d4d9dd3e15c3e5878eb1ffe5f0cea00060141dd1e"},
{"name":"sentry-rails","version":"5.22.1","platform":"ruby","checksum":"23227608dc0e202de8cf96840a591e52bd7d6967ebaed6eb2da50a7d2a2d3fb7"},
{"name":"sentry-ruby","version":"5.22.1","platform":"ruby","checksum":"ed77bdd76da7a4c6a3de43dc6d19d3c0412b2675b014a2654bc5bafd4d5b3289"},
{"name":"sentry-sidekiq","version":"5.22.1","platform":"ruby","checksum":"bd7a3f915e58e13ea67251d9a458667fc4bee6dfbbd12614c47daa239e822a89"},
{"name":"sentry-rails","version":"5.23.0","platform":"ruby","checksum":"8d2cbc3c85e343c1e882d7c8595d410e0c3afa3b005f51430225b938e128dec4"},
{"name":"sentry-ruby","version":"5.23.0","platform":"ruby","checksum":"8e8bb2f9a56a267a50fcba947f2ae131b6542f45fc3bb5764c2c25ba68f385cc"},
{"name":"sentry-sidekiq","version":"5.23.0","platform":"ruby","checksum":"34dc6413a25773e185acba605b0ed4dcec5edf3e8e562447b7b44ed6435d1c18"},
{"name":"shellany","version":"0.0.1","platform":"ruby","checksum":"0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7"},
{"name":"shoulda-matchers","version":"6.4.0","platform":"ruby","checksum":"9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0"},
{"name":"sidekiq-cron","version":"1.12.0","platform":"ruby","checksum":"6663080a454088bd88773a0da3ae91e554b8a2e8b06cfc629529a83fd1a3096c"},

View File

@ -753,7 +753,7 @@ GEM
gitlab-cloud-connector (1.9.0)
activesupport (~> 7.0)
jwt (~> 2.9.3)
gitlab-dangerfiles (4.8.1)
gitlab-dangerfiles (4.9.1)
danger (>= 9.3.0)
danger-gitlab (>= 8.0.0)
rake (~> 13.0)
@ -1792,14 +1792,14 @@ GEM
pastel (~> 0.8.0)
thor (~> 1.3)
tty-command (~> 0.10.1)
sentry-rails (5.22.1)
sentry-rails (5.23.0)
railties (>= 5.0)
sentry-ruby (~> 5.22.1)
sentry-ruby (5.22.1)
sentry-ruby (~> 5.23.0)
sentry-ruby (5.23.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
sentry-sidekiq (5.22.1)
sentry-ruby (~> 5.22.1)
sentry-sidekiq (5.23.0)
sentry-ruby (~> 5.23.0)
sidekiq (>= 3.0)
shellany (0.0.1)
shoulda-matchers (6.4.0)
@ -2165,7 +2165,7 @@ DEPENDENCIES
gitlab-backup-cli!
gitlab-chronic (~> 0.10.5)
gitlab-cloud-connector (~> 1.5)
gitlab-dangerfiles (~> 4.8.0)
gitlab-dangerfiles (~> 4.9.0)
gitlab-duo-workflow-service-client (~> 0.1)!
gitlab-experiment (~> 0.9.1)
gitlab-fog-azure-rm (~> 2.2.0)
@ -2377,9 +2377,9 @@ DEPENDENCIES
seed-fu (~> 2.3.7)
selenium-webdriver (~> 4.21, >= 4.21.1)
semver_dialects (~> 3.7)
sentry-rails (~> 5.22.0)
sentry-ruby (~> 5.22.0)
sentry-sidekiq (~> 5.22.0)
sentry-rails (~> 5.23.0)
sentry-ruby (~> 5.23.0)
sentry-sidekiq (~> 5.23.0)
shoulda-matchers (~> 6.4.0)
sidekiq!
sidekiq-cron (~> 1.12.0)

View File

@ -220,7 +220,7 @@
{"name":"gitlab","version":"4.19.0","platform":"ruby","checksum":"3f645e3e195dbc24f0834fbf83e8ccfb2056d8e9712b01a640aad418a6949679"},
{"name":"gitlab-chronic","version":"0.10.6","platform":"ruby","checksum":"a244d11a1396d2aac6ae9b2f326adf1605ec1ad20c29f06e8b672047d415a9ac"},
{"name":"gitlab-cloud-connector","version":"1.9.0","platform":"ruby","checksum":"247ce56a7f429228f8f0874844f006bc2927ffc9e3a39964bb6a993c9dbf931c"},
{"name":"gitlab-dangerfiles","version":"4.8.1","platform":"ruby","checksum":"bbad321c9638152a643d27a20b35ba1e2d8eddcc6bdfc4493d7b96e816ecf300"},
{"name":"gitlab-dangerfiles","version":"4.9.1","platform":"ruby","checksum":"296b19d8aca5e4da8d391234914a1c4dfedc29700ddbcd9c554b6ffaa7fdf1b2"},
{"name":"gitlab-experiment","version":"0.9.1","platform":"ruby","checksum":"f230ee742154805a755d5f2539dc44d93cdff08c5bbbb7656018d61f93d01f48"},
{"name":"gitlab-fog-azure-rm","version":"2.2.0","platform":"ruby","checksum":"31aa7c2170f57874053144e7f716ec9e15f32e71ffbd2c56753dce46e2e78ba9"},
{"name":"gitlab-glfm-markdown","version":"0.0.29","platform":"aarch64-linux-gnu","checksum":"b4c12b3f87c27f4397344b58b37bb7db6d635747bb88bc9ffe57664b743b6d7b"},
@ -693,9 +693,9 @@
{"name":"seed-fu","version":"2.3.9","platform":"ruby","checksum":"6d902d12dc1b88a16d487506baacc93b3a92e3671fdd603110d1600d35fbf478"},
{"name":"selenium-webdriver","version":"4.27.0","platform":"ruby","checksum":"8821f4ad60b935cfcdc5954c0a6642d894e936250aece8bf37a6fcbebe5eb6e0"},
{"name":"semver_dialects","version":"3.7.0","platform":"ruby","checksum":"6110b05266f7c8ce7794869d4d9dd3e15c3e5878eb1ffe5f0cea00060141dd1e"},
{"name":"sentry-rails","version":"5.22.1","platform":"ruby","checksum":"23227608dc0e202de8cf96840a591e52bd7d6967ebaed6eb2da50a7d2a2d3fb7"},
{"name":"sentry-ruby","version":"5.22.1","platform":"ruby","checksum":"ed77bdd76da7a4c6a3de43dc6d19d3c0412b2675b014a2654bc5bafd4d5b3289"},
{"name":"sentry-sidekiq","version":"5.22.1","platform":"ruby","checksum":"bd7a3f915e58e13ea67251d9a458667fc4bee6dfbbd12614c47daa239e822a89"},
{"name":"sentry-rails","version":"5.23.0","platform":"ruby","checksum":"8d2cbc3c85e343c1e882d7c8595d410e0c3afa3b005f51430225b938e128dec4"},
{"name":"sentry-ruby","version":"5.23.0","platform":"ruby","checksum":"8e8bb2f9a56a267a50fcba947f2ae131b6542f45fc3bb5764c2c25ba68f385cc"},
{"name":"sentry-sidekiq","version":"5.23.0","platform":"ruby","checksum":"34dc6413a25773e185acba605b0ed4dcec5edf3e8e562447b7b44ed6435d1c18"},
{"name":"shellany","version":"0.0.1","platform":"ruby","checksum":"0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7"},
{"name":"shoulda-matchers","version":"6.4.0","platform":"ruby","checksum":"9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0"},
{"name":"sidekiq-cron","version":"1.12.0","platform":"ruby","checksum":"6663080a454088bd88773a0da3ae91e554b8a2e8b06cfc629529a83fd1a3096c"},

View File

@ -753,7 +753,7 @@ GEM
gitlab-cloud-connector (1.9.0)
activesupport (~> 7.0)
jwt (~> 2.9.3)
gitlab-dangerfiles (4.8.1)
gitlab-dangerfiles (4.9.1)
danger (>= 9.3.0)
danger-gitlab (>= 8.0.0)
rake (~> 13.0)
@ -1792,14 +1792,14 @@ GEM
pastel (~> 0.8.0)
thor (~> 1.3)
tty-command (~> 0.10.1)
sentry-rails (5.22.1)
sentry-rails (5.23.0)
railties (>= 5.0)
sentry-ruby (~> 5.22.1)
sentry-ruby (5.22.1)
sentry-ruby (~> 5.23.0)
sentry-ruby (5.23.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
sentry-sidekiq (5.22.1)
sentry-ruby (~> 5.22.1)
sentry-sidekiq (5.23.0)
sentry-ruby (~> 5.23.0)
sidekiq (>= 3.0)
shellany (0.0.1)
shoulda-matchers (6.4.0)
@ -2165,7 +2165,7 @@ DEPENDENCIES
gitlab-backup-cli!
gitlab-chronic (~> 0.10.5)
gitlab-cloud-connector (~> 1.5)
gitlab-dangerfiles (~> 4.8.0)
gitlab-dangerfiles (~> 4.9.0)
gitlab-duo-workflow-service-client (~> 0.1)!
gitlab-experiment (~> 0.9.1)
gitlab-fog-azure-rm (~> 2.2.0)
@ -2377,9 +2377,9 @@ DEPENDENCIES
seed-fu (~> 2.3.7)
selenium-webdriver (~> 4.21, >= 4.21.1)
semver_dialects (~> 3.7)
sentry-rails (~> 5.22.0)
sentry-ruby (~> 5.22.0)
sentry-sidekiq (~> 5.22.0)
sentry-rails (~> 5.23.0)
sentry-ruby (~> 5.23.0)
sentry-sidekiq (~> 5.23.0)
shoulda-matchers (~> 6.4.0)
sidekiq!
sidekiq-cron (~> 1.12.0)

View File

@ -73,7 +73,7 @@ module RapidDiffs
if !!ActiveModel::Type::Boolean.new.cast(params.permit(:diff_blobs)[:diff_blobs])
stream_diff_blobs(options, view_context)
else
stream_diff_collection(diffs.diff_files, view_context)
stream_diff_collection(diffs.diff_files(sorted: sorted?), view_context)
end
end
@ -86,13 +86,12 @@ module RapidDiffs
def each_growing_slice(collection, initial_size, growth_factor = 2)
position = 0
size = initial_size
total = collection.count
total = collection.size
while position < total
end_pos = [position + size, total].min
yield collection.to_a[position...end_pos] if block_given?
yield collection.drop(position).first(size)
position = end_pos
position = [position + size, total].min
size = (size * growth_factor).to_i
end
end
@ -108,6 +107,10 @@ module RapidDiffs
end
end
def sorted?
false
end
class Request < SimpleDelegator
def format
Mime::Type.lookup("text/html")

View File

@ -58,5 +58,3 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
@sort = params[:sort]
end
end
Dashboard::ProjectsController.prepend_mod_with('Dashboard::ProjectsController')

View File

@ -98,5 +98,3 @@ module Organizations
end
end
end
Organizations::OrganizationsController.prepend_mod

View File

@ -137,7 +137,10 @@ class Projects::ForksController < Projects::ApplicationController
def load_namespaces_with_associations
# rubocop: disable CodeReuse/ActiveRecord
@load_namespaces_with_associations ||= fork_service.valid_fork_targets(only_groups: true).preload(:route)
@load_namespaces_with_associations ||= fork_service
.valid_fork_targets(only_groups: true)
.with_deletion_schedule_only
.preload(:route)
# rubocop: enable CodeReuse/ActiveRecord
end

View File

@ -16,6 +16,10 @@ module Projects
.with_collection(diff_files, merge_request: @merge_request, parallel_view: view == :parallel)
.render_in(view_context)
end
def sorted?
true
end
end
end
end

View File

@ -4,7 +4,6 @@
# Support for delayed deletion is provided.
#
# The #self_deletion_in_progress? method needs to be defined.
# The #delayed_deletion_available? method can be overriden.
# The #delayed_deletion_configured? method can be overriden.
# The #all_scheduled_for_deletion_in_hierarchy_chain method can be overriden.
module DeletableNamespace
@ -29,13 +28,6 @@ module DeletableNamespace
# TODO: Replace calls to #marked_for_deletion? with #self_deletion_scheduled?
alias_method :marked_for_deletion?, :self_deletion_scheduled?
# Returns true if the delayed deletion feature is available for the current record.
# Can be overidden.
def delayed_deletion_available?
respond_to?(:licensed_feature_available?) &&
licensed_feature_available?(:adjourned_deletion_for_projects_and_groups)
end
# Returns true if the delayed deletion feature is configured.
# Can be overidden.
def delayed_deletion_configured?
@ -69,7 +61,7 @@ module DeletableNamespace
end
def delayed_deletion_ready?
delayed_deletion_available? && delayed_deletion_configured?
delayed_deletion_configured?
end
# TODO: Replace calls to #adjourned_deletion? with #delayed_deletion_ready?
alias_method :adjourned_deletion?, :delayed_deletion_ready?

View File

@ -958,7 +958,7 @@ class MergeRequest < ApplicationRecord
if block_given?
source_project.repository.diffs_by_changed_paths(diff.diff_refs, offset, &)
else
diff.diffs(diff_options)
diff.diffs_for_streaming(diff_options)
end
end
@ -2536,7 +2536,7 @@ class MergeRequest < ApplicationRecord
def first_diffs_slice(limit, diff_options = {})
diff = diffable_merge_ref? ? merge_head_diff : merge_request_diff
diff.paginated_diffs(1, limit, diff_options).diff_files
diff.paginated_diffs(1, limit, diff_options).diff_files(sorted: true)
end
def squash_option

View File

@ -454,6 +454,30 @@ class MergeRequestDiff < ApplicationRecord
base_commit_sha? && head_commit_sha? && start_commit_sha?
end
def diffs_for_streaming(diff_options = {})
fetching_repository_diffs(diff_options) do |comparison|
reorder_diff_files!
collection = Gitlab::Diff::FileCollection::MergeRequestDiffStream.new(
self,
diff_options: diff_options
)
if comparison
# Delete the offset_index from options since we don't want to offset
# the diffs we will request given that we are already requesting specific
# paths
diff_options.delete(:offset_index)
diff_options[:generated_files] = comparison.generated_files
diff_options[:paths] = collection.diff_paths
comparison.diffs(diff_options)
else
collection
end
end
end
def diffs_in_batch(batch_page, batch_size, diff_options:)
fetching_repository_diffs(diff_options) do |comparison|
Gitlab::Metrics.measure(:diffs_reorder) do

View File

@ -785,6 +785,11 @@ class Namespace < ApplicationRecord
!!deleted_at
end
# Only groups can be marked for deletion
def marked_for_deletion?
false
end
def uploads_sharding_key
{ namespace_id: id }
end

View File

@ -30,6 +30,8 @@ class ForkNamespaceEntity < Grape::Entity
markdown_description(namespace)
end
expose :marked_for_deletion?, as: :marked_for_deletion
private
def membership(user, object, memberships)
@ -42,5 +44,3 @@ class ForkNamespaceEntity < Grape::Entity
markdown_field(namespace, :description)
end
end
ForkNamespaceEntity.prepend_mod_with('ForkNamespaceEntity')

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class DropAsyncIssuesHealthStatusCreatedAtIndex < Gitlab::Database::Migration[2.3]
milestone '18.0'
INDEX_NAME = 'index_issues_on_project_id_health_status_created_at_id'
COLUMNS = %i[project_id health_status created_at id]
def up
prepare_async_index_removal :issues, COLUMNS, name: INDEX_NAME
end
def down
unprepare_async_index :issues, COLUMNS, name: INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class DropAsyncIssuesStateIdIndex < Gitlab::Database::Migration[2.3]
milestone '18.0'
INDEX_NAME = 'idx_issues_on_state_id'
COLUMNS = %i[state_id]
def up
prepare_async_index_removal :issues, COLUMNS, name: INDEX_NAME
end
def down
unprepare_async_index :issues, COLUMNS, name: INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class DropAsyncIssuesConfidentialIndex < Gitlab::Database::Migration[2.3]
milestone '18.0'
INDEX_NAME = 'index_issues_on_confidential'
COLUMNS = %i[confidential]
def up
prepare_async_index_removal :issues, COLUMNS, name: INDEX_NAME
end
def down
unprepare_async_index :issues, COLUMNS, name: INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class DropAsyncIssuesProjectIdStateIdCreatedAt < Gitlab::Database::Migration[2.3]
milestone '18.0'
INDEX_NAME = 'index_issues_on_project_id_and_state_id_and_created_at_and_id'
COLUMNS = %i[project_id state_id created_at id]
def up
prepare_async_index_removal :issues, COLUMNS, name: INDEX_NAME
end
def down
unprepare_async_index :issues, COLUMNS, name: INDEX_NAME
end
end

View File

@ -0,0 +1 @@
9305fc522952f61adecaf3a1693615f3e5814eee724c6c149cfe9a8d072c9130

View File

@ -0,0 +1 @@
90c84475bb640cf833bf72b3659aa1bee6336ae88af026b98502fdb284c97f75

View File

@ -0,0 +1 @@
653d7a00d96a920368bc08de042c3dd34e61d723be72c4f293a5bba726ae2688

View File

@ -0,0 +1 @@
3eb7519c5717e7ff3405df8707f47aed187065c5805ff3e8775a1b8e2aac88c1

View File

@ -29321,6 +29321,11 @@ paths:
description: Require an associated issue from Jira
type: boolean
required: false
- in: formData
name: override_params[auto_duo_code_review_enabled]
description: Enable automatic reviews by GitLab Duo on merge requests
type: boolean
required: false
- in: formData
name: file.path
description: Path to locally stored body (generated by Workhorse)
@ -29971,6 +29976,11 @@ paths:
description: Require an associated issue from Jira
type: boolean
required: false
- in: formData
name: override_params[auto_duo_code_review_enabled]
description: Enable automatic reviews by GitLab Duo on merge requests
type: boolean
required: false
responses:
'201':
description: Create a new project import using a remote object storage path
@ -30700,6 +30710,11 @@ paths:
description: Require an associated issue from Jira
type: boolean
required: false
- in: formData
name: override_params[auto_duo_code_review_enabled]
description: Enable automatic reviews by GitLab Duo on merge requests
type: boolean
required: false
responses:
'201':
description: Create a new project import using a file from AWS S3
@ -44971,6 +44986,8 @@ definitions:
type: boolean
prevent_merge_without_jira_issue:
type: string
auto_duo_code_review_enabled:
type: string
description: API_Entities_Project model
API_Entities_LicenseBasic:
type: object
@ -59735,6 +59752,9 @@ definitions:
prevent_merge_without_jira_issue:
type: boolean
description: Require an associated issue from Jira
auto_duo_code_review_enabled:
type: boolean
description: Enable automatic reviews by GitLab Duo on merge requests
repository_object_format:
type: string
description: The object format of the project repository
@ -60141,6 +60161,9 @@ definitions:
prevent_merge_without_jira_issue:
type: boolean
description: Require an associated issue from Jira
auto_duo_code_review_enabled:
type: boolean
description: Enable automatic reviews by GitLab Duo on merge requests
repository_object_format:
type: string
description: The object format of the project repository
@ -60567,6 +60590,8 @@ definitions:
type: boolean
prevent_merge_without_jira_issue:
type: string
auto_duo_code_review_enabled:
type: string
permissions:
type: object
properties:
@ -61007,6 +61032,9 @@ definitions:
prevent_merge_without_jira_issue:
type: boolean
description: Require an associated issue from Jira
auto_duo_code_review_enabled:
type: boolean
description: Enable automatic reviews by GitLab Duo on merge requests
ci_default_git_depth:
type: integer
format: int32

View File

@ -1681,6 +1681,7 @@ Supported general project attributes:
| `auto_cancel_pending_pipelines` | string | No | Auto-cancel pending pipelines. This action toggles between an enabled state and a disabled state; it is not a boolean. |
| `auto_devops_deploy_strategy` | string | No | Auto Deploy strategy (`continuous`, `manual`, or `timed_incremental`). |
| `auto_devops_enabled` | boolean | No | Enable Auto DevOps for this project. |
| `auto_duo_code_review_enabled` | boolean | No | Enable automatic reviews by GitLab Duo on merge requests. See [Duo in merge requests](../user/project/merge_requests/duo_in_merge_requests.md#have-gitlab-duo-review-your-code). Ultimate only. |
| `autoclose_referenced_issues` | boolean | No | Set whether auto-closing referenced issues on default branch. |
| `avatar` | mixed | No | Image file for avatar of the project. |
| `build_git_strategy` | string | No | The Git strategy. Defaults to `fetch`. |

View File

@ -1120,8 +1120,8 @@ if [[ -d "/builds/gitlab-examples/ci-debug-trace/.git" ]]; then
++ CI_SERVER_PROTOCOL=https
++ export CI_SERVER_NAME=GitLab
++ CI_SERVER_NAME=GitLab
++ export GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,wip_limits,adjourned_deletion_for_projects_and_groups,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal
++ GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,wip_limits,adjourned_deletion_for_projects_and_groups,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,cluster_health,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal
++ export GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,wip_limits,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal
++ GITLAB_FEATURES=audit_events,burndown_charts,code_owners,contribution_analytics,description_diffs,elastic_search,group_bulk_edit,group_burndown_charts,group_webhooks,issuable_default_templates,issue_weights,jenkins_integration,ldap_group_sync,member_lock,merge_request_approvers,multiple_issue_assignees,multiple_ldap_servers,multiple_merge_request_assignees,protected_refs_for_users,push_rules,related_issues,repository_mirrors,repository_size_limit,scoped_issue_board,usage_quotas,wip_limits,admin_audit_log,auditor_user,batch_comments,blocking_merge_requests,board_assignee_lists,board_milestone_lists,ci_cd_projects,cluster_deployments,code_analytics,code_owner_approval_required,commit_committer_check,cross_project_pipelines,custom_file_templates,custom_file_templates_for_namespace,custom_project_templates,custom_prometheus_metrics,cycle_analytics_for_groups,db_load_balancing,default_project_deletion_protection,dependency_proxy,deploy_board,design_management,email_additional_text,extended_audit_events,external_authorization_service_api_management,feature_flags,file_locks,geo,github_integration,group_allowed_email_domains,group_project_templates,group_saml,issues_analytics,jira_dev_panel_integration,ldap_group_sync_filter,merge_pipelines,merge_request_performance_metrics,merge_trains,metrics_reports,multiple_approval_rules,multiple_group_issue_boards,object_storage,operations_dashboard,packages,productivity_analytics,project_aliases,protected_environments,reject_unsigned_commits,required_ci_templates,scoped_labels,service_desk,smartcard_auth,group_timelogs,type_of_work_analytics,unprotection_restrictions,ci_project_subscriptions,cluster_health,container_scanning,dast,dependency_scanning,epics,group_ip_restriction,incident_management,insights,license_management,personal_access_token_expiration_policy,pod_logs,prometheus_alerts,report_approver_rules,sast,security_dashboard,tracing,web_ide_terminal
++ export CI_PROJECT_ID=17893
++ CI_PROJECT_ID=17893
++ export CI_PROJECT_NAME=ci-debug-trace
@ -1183,7 +1183,7 @@ This error occurs when a downstream project has [restricted pipeline variables](
```yaml
variables:
DEFAULT_VAR: "test"
trigger-job:
trigger: my-group/my-project
```

View File

@ -347,7 +347,7 @@ Here is an example scenario:
- In 17.4 the migration may be finalized, provided that it's completed in GitLab.com.
- In 17.6 the code related to the migration may be deleted.
Batched background migration code is routinely deleted when migrations are squashed.
Batched background migration code is routinely deleted when [migrations are squashed](migration_squashing.md).
### Re-queue batched background migrations

View File

@ -0,0 +1,60 @@
---
stage: Data Access
group: Database
info: Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review.
title: Migration Squashing
---
## Migration squashing
{{< history >}}
- [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105553) in GitLab 16.3.
{{< /history >}}
Migration squashing combines multiple database migrations into a single schema definition to improve database setup performance and maintain a manageable migration history.
## When to use migration squashing
Use migration squashing at the following times:
- At the start of each major release cycle
- After a required stop
- When the number of migrations has grown significantly (typically more than 200 migrations)
## Squash migrations
To squash migrations from a previous version (such as 16.10), run:
```shell
bundle exec rake "gitlab:db:squash[origin/16-10-stable-ee]"
```
This Rake task:
1. Removes all migrations from the previous version
1. Updates the schema version references in relevant files
1. Cleans up finalized batched background migrations
1. Updates CI configuration for database rollbacks
### Parameters
| Parameter | Description |
|-----------|-------------|
| `[origin/16-10-stable-ee]` | The Git reference to use as a baseline for migration squashing. This should be the stable branch of the previous version. |
## Troubleshooting
### Missing schema references
If you encounter errors related to missing schema references, check:
- Migration spec files that might reference old migrations
- Background migration files that might need manual updates
- Documentation that references specific migration versions
## Related documentation
- [Migration style guide](../migration_style_guide.md)
- [Required stops](required_stops.md)

View File

@ -124,7 +124,7 @@ In addition, there are a few circumstances where we would always run the full RS
#### Have you encountered a problem with backend predictive tests?
If so, have a look at [the Engineering Productivity RUNBOOK on predictive tests](https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/blob/main/runbooks/predictive-tests.md) for instructions on how to act upon predictive tests issues. Additionally, if you identified any test selection gaps, let `@gl-dx/eng-prod` know so that we can take the necessary steps to optimize test selections.
If so, have a look at [the Engineering Productivity RUNBOOK on predictive tests](https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/blob/main/runbooks/predictive-test-selection.md) for instructions on how to act upon predictive tests issues. Additionally, if you identified any test selection gaps, let `@gl-dx/eng-prod` know so that we can take the necessary steps to optimize test selections.
### Jest predictive jobs
@ -149,7 +149,7 @@ The `rules` definitions for full Jest tests are defined at `.frontend:rules:jest
#### Have you encountered a problem with frontend predictive tests?
If so, have a look at [the Engineering Productivity RUNBOOK on predictive tests](https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/blob/main/runbooks/predictive-tests.md) for instructions on how to act upon predictive tests issues.
If so, have a look at [the Engineering Productivity RUNBOOK on predictive tests](https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/blob/main/runbooks/predictive-test-selection.md) for instructions on how to act upon predictive tests issues.
### Fork pipelines

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
module Gitlab
module Diff
module FileCollection
class MergeRequestDiffStream < MergeRequestDiffBase
include PaginatedDiffs
def initialize(merge_request_diff, diff_options:)
super
@paginated_collection = load_paginated_collection(diff_options)
end
private
# rubocop: disable CodeReuse/ActiveRecord -- No need to abstract
def load_paginated_collection(diff_options)
relation.offset(diff_options[:offset_index].to_i || 0)
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end

View File

@ -8,7 +8,8 @@ RSpec.describe ProjectsController, feature_category: :groups_and_projects do
using RSpec::Parameterized::TableSyntax
let_it_be(:project, reload: true) { create(:project, :with_export, service_desk_enabled: false) }
let_it_be(:public_project) { create(:project, :public) }
let_it_be(:group) { create(:group) }
let_it_be(:public_project) { create(:project, :public, namespace: group) }
let_it_be(:user) { create(:user) }
let(:jpg) { fixture_file_upload('spec/fixtures/rails_sample.jpg', 'image/jpg') }
@ -495,6 +496,54 @@ RSpec.describe ProjectsController, feature_category: :groups_and_projects do
.not_to exceed_query_limit(2).for_query(expected_query)
end
end
context 'when marked for deletion' do
render_views
subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } }
let(:ancestor_notice_regex) do
/The parent group of this project is pending deletion, so this project will also be deleted on .*./
end
context 'when the parent group has not been scheduled for deletion' do
it 'does not show the notice' do
subject
expect(response.body).not_to match(ancestor_notice_regex)
end
end
context 'when the parent group has been scheduled for deletion' do
before do
create(:group_deletion_schedule,
group: public_project.group,
marked_for_deletion_on: Date.current,
deleting_user: user
)
end
it 'shows the notice that the parent group has been scheduled for deletion' do
subject
expect(response.body).to match(ancestor_notice_regex)
end
context 'when the project itself has also been scheduled for deletion' do
it 'does not show the notice that the parent group has been scheduled for deletion' do
public_project.update!(marked_for_deletion_at: Date.current)
subject
expect(response.body).not_to match(ancestor_notice_regex)
# However, shows the notice that the project has been marked for deletion.
expect(response.body).to match(
/This project is pending deletion, and will be deleted on .*. Repository and other project resources are read-only./
)
end
end
end
end
end
describe 'POST create' do

View File

@ -251,4 +251,18 @@ RSpec.describe 'Dashboard Projects', :js, feature_category: :groups_and_projects
wait_for_requests
end.not_to exceed_query_limit(control).with_threshold(4)
end
context 'for delayed deletion' do
let_it_be(:project) { create(:project, :archived, namespace: user.namespace, marked_for_deletion_at: Date.current) }
it 'renders Restore button', :js do
visit inactive_dashboard_projects_path
wait_for_requests
within_testid("projects-list-item-#{project.id}") do
click_button 'Actions'
expect(page).to have_button('Restore')
end
end
end
end

View File

@ -0,0 +1,32 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group information', :js, feature_category: :groups_and_projects do
let_it_be(:user) { create(:user) }
let_it_be(:group) do
create(:group_with_deletion_schedule, marked_for_deletion_on: Time.current, owners: user)
end
let_it_be(:subgroup) { create(:group, name: 'subgroup', parent: group) }
subject(:visit_page) { visit group_path(group) }
before do
sign_in(user)
end
context 'when group is pending deletion' do
it 'shows pending deletion badge' do
visit_page
expect(page).to have_content 'Pending deletion'
end
it 'shows pending deletion badge on subgroups' do
visit group_path(subgroup)
expect(page).to have_content 'Pending deletion'
end
end
end

View File

@ -308,6 +308,36 @@ RSpec.describe 'Edit group settings', feature_category: :groups_and_projects do
end
end
describe 'delayed project deletion' do
let(:form_group_selector) { '[data-testid="delayed-project-removal-form-group"]' }
def remove_with_confirm(button_text, confirm_with, confirm_button_text = 'Confirm')
click_button button_text
fill_in 'confirm_name_input', with: confirm_with
click_button confirm_button_text
end
context 'when immediately deleting a project marked for deletion', :js do
before do
create(:group_deletion_schedule, group: group, marked_for_deletion_on: 2.days.from_now)
visit edit_group_path(group)
end
it 'deletes the project immediately', :sidekiq_inline do
expect { remove_with_confirm('Delete group', group.path) }.to change { Group.count }.by(-1)
expect(page).to have_content "is being deleted"
end
end
it 'does not display delayed project removal field at group level', :js do
visit edit_group_path(group)
expect(page).not_to have_css(form_group_selector)
end
end
def update_path(new_group_path)
visit edit_group_path(group)

View File

@ -0,0 +1,65 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Diff::FileCollection::MergeRequestDiffStream, feature_category: :code_review_workflow do
let(:merge_request) { create(:merge_request) }
let(:offset_index) { 5 }
let(:diff_options) { { offset_index: offset_index } }
let(:diffable) { merge_request.merge_request_diff }
let(:diff_files_relation) { diffable.merge_request_diff_files }
let(:diff_files) { subject.diff_files }
subject do
described_class.new(diffable, diff_options: diff_options)
end
describe '#diff_files' do
let(:paginated_rel) { diff_files_relation.offset(offset_index) }
let(:expected_files) { paginated_rel.map(&:new_path) }
it 'returns paginated diff files' do
expect(diff_files.size).to eq(diff_files_relation.count - offset_index)
end
it 'returns correct diff files' do
expect(diff_files.map(&:new_path)).to eq(expected_files)
end
it 'returns a valid instance of a DiffCollection' do
expect(diff_files).to be_a(Gitlab::Git::DiffCollection)
end
context 'when offset_index is 0' do
let(:offset_index) { 0 }
it 'returns all diff files' do
expected_files = diff_files_relation.map(&:new_path)
expect(diff_files.map(&:new_path)).to eq(expected_files)
end
end
it 'returns generated value' do
expect(diff_files.first.generated?).not_to be_nil
end
end
it_behaves_like 'unfoldable diff' do
subject do
described_class.new(merge_request.merge_request_diff, diff_options: diff_options)
end
end
it_behaves_like 'cacheable diff collection' do
let(:cacheable_files_count) { diff_files_relation.count - offset_index }
end
it_behaves_like 'unsortable diff files' do
let(:diffable) { merge_request.merge_request_diff }
subject do
described_class.new(merge_request.merge_request_diff, diff_options: diff_options)
end
end
end

View File

@ -53,35 +53,6 @@ RSpec.describe DeletableNamespace, feature_category: :groups_and_projects do
end
end
describe '#delayed_deletion_available?' do
context 'when record doesn not respond to licensed_feature_available?' do
it 'returns nil' do
expect(record.delayed_deletion_available?).to be_falsy
end
end
shared_examples 'delayed deletion available with #licensed_feature_available? defined' do |feature_available|
context "when #licensed_feature_available? is #{feature_available}" do
before do
model.send(:define_method, :licensed_feature_available?) do |_feature_name|
feature_available
end
end
it "returns #{feature_available}" do
expect(record).to receive(:licensed_feature_available?)
.with(:adjourned_deletion_for_projects_and_groups)
.and_call_original
expect(record.delayed_deletion_available?).to be(feature_available)
end
end
end
it_behaves_like 'delayed deletion available with #licensed_feature_available? defined', true
it_behaves_like 'delayed deletion available with #licensed_feature_available? defined', false
end
describe '#delayed_deletion_configured?' do
context 'when Gitlab::CurrentSettings.deletion_adjourned_period > 0' do
before do
@ -199,9 +170,9 @@ RSpec.describe DeletableNamespace, feature_category: :groups_and_projects do
end
describe '#delayed_deletion_ready? & #adjourned_deletion?' do
context 'when #delayed_deletion_available? is false' do
context 'when #delayed_deletion_configured? is false' do
before do
allow(record).to receive(:delayed_deletion_available?).and_return(false)
allow(record).to receive(:delayed_deletion_configured?).and_return(false)
end
it 'returns false' do
@ -210,31 +181,14 @@ RSpec.describe DeletableNamespace, feature_category: :groups_and_projects do
end
end
context 'when #delayed_deletion_available? is true' do
context 'when #delayed_deletion_configured? is true' do
before do
allow(record).to receive(:delayed_deletion_available?).and_return(true)
allow(record).to receive(:delayed_deletion_configured?).and_return(true)
end
context 'when #delayed_deletion_configured? is false' do
before do
allow(record).to receive(:delayed_deletion_configured?).and_return(false)
end
it 'returns false' do
expect(record.delayed_deletion_ready?).to be_falsy
expect(record.adjourned_deletion?).to be_falsy
end
end
context 'when #delayed_deletion_configured? is true' do
before do
allow(record).to receive(:delayed_deletion_configured?).and_return(true)
end
it 'returns true' do
expect(record.delayed_deletion_ready?).to be_truthy
expect(record.adjourned_deletion?).to be_truthy
end
it 'returns true' do
expect(record.delayed_deletion_ready?).to be_truthy
expect(record.adjourned_deletion?).to be_truthy
end
end
end

View File

@ -709,6 +709,65 @@ RSpec.describe MergeRequestDiff, feature_category: :code_review_workflow do
end
end
describe '#diffs_for_streaming' do
shared_examples 'diffs with generated files check' do
it 'checks generated files' do
diffs = diff_with_commits.diffs_for_streaming(offset_index: 0)
expect(diffs.diff_files.first.generated?).not_to be_nil
end
end
context 'when no persisted files available' do
before do
diff_with_commits.clean!
end
it_behaves_like 'diffs with generated files check'
it 'returns a Gitlab::Diff::FileCollection::Compare' do
diffs = diff_with_commits.diffs_for_streaming(offset_index: 5)
expect(diffs).to be_a(Gitlab::Diff::FileCollection::Compare)
expect(diffs.diff_files.size).to eq(15)
end
end
context 'when persisted files available' do
it_behaves_like 'diffs with generated files check'
it 'returns paginated diffs' do
diffs = diff_with_commits.diffs_for_streaming(offset_index: 5)
expect(diffs).to be_a(Gitlab::Diff::FileCollection::MergeRequestDiffStream)
expect(diffs.diff_files.size).to eq(15)
end
it 'sorts diff files directory first' do
diff_with_commits.update!(sorted: false) # Mark as unsorted so it'll re-order
expect(diff_with_commits.diffs_for_streaming(offset_index: 5).diff_paths).to eq(
[
'files/lfs/lfs_object.iso',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
'files/.DS_Store',
'files/whitespace',
'foo/bar/.gitkeep',
'with space/README.md',
'.DS_Store',
'.gitattributes',
'.gitignore',
'.gitmodules',
'CHANGELOG',
'README',
'gitlab-grack',
'gitlab-shell'
])
end
end
end
describe '#diffs' do
let(:diff_options) { {} }

View File

@ -7022,14 +7022,14 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev
let(:base_diff) do
instance_double(
MergeRequestDiff,
diffs: ['base diff']
diffs_for_streaming: ['base diff']
)
end
let(:head_diff) do
instance_double(
MergeRequestDiff,
diffs: ['HEAD diff']
diffs_for_streaming: ['HEAD diff']
)
end

View File

@ -141,6 +141,21 @@ RSpec.describe 'getting group information', :with_license, feature_category: :gr
end
end
context 'when marked_for_deletion_on filter is applied' do
let(:marked_for_deletion_on) { Date.parse('2024-01-01') }
let(:group) do
create(:group_with_deletion_schedule, marked_for_deletion_on: marked_for_deletion_on, owners: user2)
end
it 'returns groups with marked_for_deletion_on' do
post_graphql(group_query(group), current_user: user2)
expect(response).to have_gitlab_http_status(:ok)
expect(graphql_data['group']['id']).to eq(group.to_global_id.to_s)
expect(graphql_data['group']['markedForDeletionOn']).to eq(marked_for_deletion_on.iso8601)
end
end
context 'with timelog categories' do
let_it_be(:group) { create(:group) }
let_it_be(:timelog_category) { create(:timelog_category, namespace: group, name: 'TimelogCategoryTest') }

View File

@ -230,4 +230,29 @@ RSpec.describe 'getting a collection of projects', feature_category: :source_cod
)
end
end
context 'when providing marked_for_deletion_on filter', :freeze_time do
let_it_be(:path) { %i[projects nodes] }
let_it_be(:marked_for_deletion_on) { Date.yesterday }
let_it_be(:project_marked_for_deletion) do
create(:project, marked_for_deletion_at: marked_for_deletion_on, developers: current_user)
end
let_it_be(:second_project_marked_for_deletion) do
create(:project, marked_for_deletion_at: marked_for_deletion_on - 1.day, developers: current_user)
end
let(:filters) { { marked_for_deletion_on: marked_for_deletion_on } }
it 'returns the expected projects' do
post_graphql(query, current_user: current_user)
returned_projects = graphql_data_at(*path)
returned_ids = returned_projects.pluck('id')
returned_marked_for_deletion_on = returned_projects.pluck('markedForDeletionOn')
expect(returned_ids).to contain_exactly(project_marked_for_deletion.to_global_id.to_s)
expect(returned_marked_for_deletion_on).to contain_exactly(marked_for_deletion_on.iso8601)
end
end
end

View File

@ -25,17 +25,18 @@ RSpec.describe ForkNamespaceEntity do
is_expected.not_to be_nil
end
%w[id
%i[id
name
description
markdown_description
marked_for_deletion
visibility
full_name
created_at
updated_at
avatar_url].each do |attribute|
it "includes #{attribute}" do
expect(json[attribute.to_sym]).to be_present
expect(json).to have_key(attribute)
end
end
@ -54,4 +55,8 @@ RSpec.describe ForkNamespaceEntity do
it 'exposes human readable permission level' do
expect(json[:permission]).to eql 'Developer'
end
it 'exposes marked_for_deletion state' do
expect(json[:marked_for_deletion]).to be false
end
end

View File

@ -114,7 +114,6 @@ RSpec.describe GroupChildEntity do
let_it_be(:deletion_adjourned_period) { 14 }
before do
stub_licensed_features(adjourned_deletion_for_projects_and_groups: true)
stub_application_setting(deletion_adjourned_period: deletion_adjourned_period)
end

View File

@ -1,10 +1,6 @@
# frozen_string_literal: true
RSpec.shared_examples 'adjourned deletion service' do
before do
stub_licensed_features(adjourned_deletion_for_projects_and_groups: true)
end
shared_examples 'user can remove resource' do
it 'enqueues the resource destroy worker' do
expect(destroy_worker).to receive(perform_method).with(*destroy_worker_params)

View File

@ -120,6 +120,38 @@ RSpec.describe 'groups/edit.html.haml', feature_category: :groups_and_projects d
end
end
context 'when restoring a group' do
let_it_be(:user) { create(:user) }
let_it_be_with_reload(:group) { create(:group, owners: user) }
before do
assign(:group, group)
allow(view).to receive(:current_user) { user }
end
context 'when group is pending deletion' do
before do
create(:group_deletion_schedule, group: group, deleting_user: user)
end
it 'renders restore group card and action' do
render
expect(rendered).to render_template('shared/groups_projects/settings/_restore')
expect(rendered).to have_link('Restore group')
end
end
context 'when group is not pending deletion' do
it 'does not render restore group card and action' do
render
expect(rendered).to render_template('shared/groups_projects/settings/_restore')
expect(rendered).not_to have_link('Restore group')
end
end
end
context 'ip_restriction' do
let(:group) { create(:group) }
let(:user) { create(:user) }

View File

@ -22,7 +22,6 @@ RSpec.describe AdjournedGroupDeletionWorker, feature_category: :groups_and_proje
before do
stub_application_setting(deletion_adjourned_period: 14)
stub_licensed_features(adjourned_deletion_for_projects_and_groups: true)
end
context 'when deleting user has access to delete the group' do

View File

@ -0,0 +1,97 @@
# CI/CD Failure Categories
## Overview
The CI/CD Failure Categories system is a toolset for automatically analyzing CI job failures, categorizing them based on patterns in job logs, and reporting these categories through internal events. This enables better tracking, debugging, and resolution of CI pipeline failures.
## Architecture
The system consists of three main components:
1. **DownloadJobTrace** - Downloads the job trace (log) from the GitLab API
2. **JobTraceToFailureCategory** - Analyzes the trace to determine the failure category based on pattern matching
3. **ReportJobFailure** - Reports the failure category via internal events for tracking and analysis
These components are orchestrated by the `FailureAnalyzer` class which handles the end-to-end process.
## Failure Categories
The system recognizes a wide range of failure categories organized into three types of pattern matching:
- **Single-line patterns** ([single_line_patterns.yml](patterns/single_line_patterns.yml)) - Matches failures found on a single line
- **Multi-line patterns** ([multiline_patterns.yml](patterns/multiline_patterns.yml)) - Matches failures that require detecting multiple patterns across different lines
- **Catchall patterns** ([catchall_patterns.yml](patterns/catchall_patterns.yml)) - Used as fallbacks when more specific patterns don't match
Each category contains:
- A descriptive name
- A detailed description of what the failure means
- One or more regex patterns to match in job logs
## Usage
### Command Line
```bash
# Add the `failure category analysis (fca)` to your .bashrc/.zshrc:
alias fca='PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE="${GITLAB_API_PRIVATE_TOKEN}" ~/src/gdk/gitlab/tooling/lib/tooling/glci/local_batch_failure_analyzer.rb'
# Analyze a single job by URL
fca https://gitlab.com/gitlab-org/gitlab/-/jobs/12345
# Analyze multiple jobs from a CSV file
fca --csv failed_jobs.csv
```
The CSV file should have the following format:
```
CREATED_AT,JOB_URL
2025-04-30T00:29:26.195478Z,https://gitlab.com/gitlab-org/gitlab/-/jobs/12345
2025-04-30T00:29:26.04171Z,https://gitlab.com/gitlab-org/gitlab/-/jobs/12346
```
You can also use the individual scripts directly:
```bash
# Analyze a single job
./tooling/lib/tooling/glci/failure_analyzer.rb <job_id>
# Local batch processing for multiple jobs
./tooling/lib/tooling/glci/local_batch_failure_analyzer.rb <job_url>
# Batch processing with a CSV file
./tooling/lib/tooling/glci/local_batch_failure_analyzer.rb --csv <csv_file_path>
```
### Required Environment Variables
When used within GitLab CI, these environment variables are typically available automatically:
```
CI_API_V4_URL
CI_PROJECT_ID
CI_JOB_ID
PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE
CI_JOB_STATUS
```
For local usage, you'll need to set these manually (see script headers for examples).
## Extending the System
### Adding New Failure Categories
1. Identify patterns in CI job logs that indicate specific types of failures
2. Add these patterns to the appropriate YAML file:
- For single-line patterns: `single_line_patterns.yml`
- For multi-line patterns: `multiline_patterns.yml`
- For catchall patterns: `catchall_patterns.yml`
3. Follow the existing format:
```yaml
failure_categories:
category_name:
description: "Detailed description of this failure type"
patterns:
- "regex pattern 1"
- "regex pattern 2"
```
4. The order of categories matters! Patterns are matched from top to bottom.

File diff suppressed because it is too large Load Diff

View File

@ -4,160 +4,545 @@ failure_categories:
description: "Ruby interpreter crashes with a core dump, often showing stack traces with 'Control frame information'. These indicate severe runtime errors like memory corruption or bugs in C extensions that cause the Ruby VM to terminate unexpectedly."
patterns:
- "Control frame information"
causes:
- "Memory corruption in Ruby VM"
- "Bugs in native C extensions"
- "Stack overflow due to infinite recursion"
- "Segmentation faults in the Ruby interpreter"
- "YJIT (Ruby's JIT compiler) bugs"
solutions:
- "Check for recent gem updates that might have introduced C extension issues"
- "Look for recursive code that might cause stack overflow"
- "Run without YJIT by setting `RUBY_YJIT_ENABLE=0`"
- "Try reproducing locally to collect more detailed crash information"
- "If reproducible, report the issue to the Ruby core team or relevant gem maintainers"
ruby_yjit_panick:
description: "Panic errors in Ruby's YJIT (Yet Another Just-In-Time) compiler, which accelerates Ruby code execution. YJIT panics typically indicate internal compiler bugs or memory-related issues in the JIT implementation."
patterns:
- "ruby: YJIT has panicked"
causes:
- "Bugs in YJIT implementation"
- "Unsupported Ruby language features used with YJIT"
- "Memory issues in the JIT compilation process"
- "Incompatibilities between Ruby version and YJIT version"
solutions:
- "Disable YJIT by setting `RUBY_YJIT_ENABLE=0` environment variable"
- "Update to the latest Ruby patch version which may contain YJIT fixes"
- "Report the issue to Ruby core team with reproducible example if possible"
- "Check for known YJIT issues in the Ruby issue tracker"
ruby_openssl:
description: "OpenSSL-related errors in Ruby, typically involving SSL certificate validation failures, connection issues, or encryption/decryption problems. Often seen during HTTPS connections to external services."
patterns:
- "OpenSSL::SSL::SSLError"
causes:
- "SSL certificate validation failures"
- "Outdated CA certificates"
- "Mismatched protocol versions (TLS 1.0/1.1/1.2/1.3)"
- "Connection resets during SSL handshake"
- "Invalid certificate or certificate chain"
- "Hostname verification failures"
solutions:
- "Update CA certificates on the system or in the Docker image"
- "Check that the external service supports modern TLS versions"
- "Verify the SSL certificate is valid and properly configured"
- "If testing, consider using `OpenSSL::SSL::VERIFY_NONE` for development environments only"
- "For connection resets, try increasing timeouts or checking network stability"
- "Ensure hostname in certificate matches the server being accessed"
ruby_could_not_load_file:
description: "Ruby cannot load required files or libraries, which may be due to missing gems, incorrect load paths, or dependency issues. These errors prevent code from being properly loaded and executed."
patterns:
- "LoadError:"
- "cannot load such file"
causes:
- "Missing gem dependencies"
- "Incorrect load paths"
- "Gems installed but not properly required"
- "Mismatched gem versions between Gemfile.lock and installed gems"
- "Native extension build failures during gem installation"
solutions:
- "Run `bundle install` to ensure all dependencies are installed"
- "Check `require` statements for correct file paths and naming"
- "Verify that the gem is listed in your Gemfile"
- "For native extensions, ensure development headers are installed (e.g., `libpq-dev` for pg gem)"
- "Try `bundle pristine` to reinstall gems from scratch"
- "Check for path issues in require statements - remember Ruby load paths are relative"
ruby_undefined_method_or_variable:
description: "References to undefined local variables or methods in Ruby code, typically caused by typos, missing method definitions, or scope issues. These errors occur when code tries to access variables or call methods that don't exist."
patterns:
- "undefined local variable or method `"
- "undefined method `"
causes:
- "Typos in method or variable names"
- "Method defined in a different scope than where it's called"
- "Missing require statements for modules that define the method"
- "Calling methods on nil values (NoMethodError)"
- "Using a method that was renamed or removed"
- "Method defined as private or protected but called from outside context"
solutions:
- "Check for typos in the method or variable name"
- "Ensure the method is defined in the correct scope and properly required"
- "Add nil checks before calling methods on potentially nil objects"
- "Verify method visibility (public/private/protected) matches how it's being called"
- "Check the method signature for any recent changes"
- "For class methods, ensure using `.method` (not `#method`) notation in documentation"
ruby_frozen:
description: "Attempts to modify frozen (immutable) objects in Ruby, such as strings, arrays, or hashes that have been marked as read-only. Occurs when code tries to alter objects that have been frozen with the freeze method."
patterns:
- "FrozenError:"
causes:
- "Attempting to modify a frozen object"
- "Ruby constants are implicitly frozen in recent Ruby versions"
- "Objects frozen by `freeze` method call"
- "Strings in string literals with frozen_string_literal pragma"
- "Modifying objects returned from methods that return frozen instances"
solutions:
- "Create a duplicate using `.dup` before modifying the object"
- "For strings, use unfrozen string literals with `# frozen_string_literal: false`"
- "Check if an object is frozen before attempting modification with `.frozen?`"
- "Redesign code to avoid modifying frozen objects"
- "For constants, assign a new value rather than trying to modify in place"
ruby_wrong_argument_type:
description: "Type mismatch errors where methods receive arguments of the wrong type. These occur when a method expects one type of object (like a Module) but receives another (like a Class)."
patterns:
- "wrong argument type.+expected.+"
causes:
- "Passing an object of incorrect type to a method"
- "Type conversion errors (e.g., trying to convert non-numeric string to number)"
- "Class vs. Module confusion in metaprogramming"
- "Using a symbol when a string is expected or vice versa"
- "Passing wrong object type to built-in methods"
solutions:
- "Check the method signature and ensure arguments match expected types"
- "Add explicit type conversion where needed (e.g., `to_s`, `to_i`, etc.)"
- "For complex types, verify the object's class with `object.class` or `object.is_a?`"
- "Review documentation for correct argument types"
- "Consider adding type validation at the beginning of methods"
ruby_uninitialized_constant:
description: "References to Ruby constants (classes or modules) that haven't been defined or properly loaded. Often occurs due to missing requires, autoloading issues, or namespace problems."
patterns:
- "uninitialized constant "
causes:
- "Missing `require` statement for file defining the constant"
- "Namespace resolution issues (e.g., using `ClassName` instead of `Module::ClassName`)"
- "Autoloading failures"
- "Typos in constant names"
- "Circular dependencies preventing proper initialization"
solutions:
- "Add necessary `require` statements at the top of the file"
- "Check for correct namespace resolution, using full path when needed (`::ClassName`)"
- "Verify spelling of constant names"
- "For Rails, ensure autoload paths include the correct directories"
- "Break circular dependencies by restructuring code"
- "Make sure the constant is defined before it's used"
ruby_gitlab_settings_missing_setting:
description: "Missing configuration settings in GitLab's settings framework, occurring when code tries to access configuration options that haven't been defined. Usually requires updating configuration files or adding missing settings."
patterns:
- "GitlabSettings::MissingSetting"
causes:
- "Setting referenced in code but not defined in configuration"
- "Configuration file missing required settings"
- "Environment-specific setting not defined for current environment"
- "Typo in setting name"
- "New feature requiring configuration not yet added to settings"
solutions:
- "Add the missing setting to appropriate configuration file"
- "Check for typos in setting name used in code"
- "Ensure setting is defined for the current environment"
- "Add default value for the setting if appropriate"
- "Check recent changes that might have introduced new required settings"
ruby_syntax:
description: "Ruby syntax errors, including unexpected tokens, missing keywords, or malformed code structures. These prevent code from being parsed and must be fixed before execution."
patterns:
- "syntax error, unexpected"
- "SyntaxError"
causes:
- "Missing `end` keywords for blocks, methods, or classes"
- "Unclosed string literals, arrays, or hashes"
- "Invalid Ruby syntax or attempting to use features from newer Ruby versions"
- "Mismatched brackets, parentheses, or quotes"
- "Using reserved keywords as variable or method names"
solutions:
- "Carefully review code for syntax issues highlighted in the error message"
- "Use a code editor with syntax highlighting and linting"
- "Check for matching pairs of brackets, quotes, and `do`/`end` blocks"
- "Run `rubocop` locally to catch syntax issues before committing"
- "Ensure code is compatible with the Ruby version used in CI"
- "For complex syntax issues, simplify the code structure"
ruby_eof:
description: "Unexpected end-of-file errors in Ruby, typically occurring when reading from streams or files that unexpectedly terminate. Often seen in network operations or file parsing."
patterns:
- "EOFError"
causes:
- "Attempting to read beyond the end of a file or stream"
- "Network connection closed unexpectedly during read operation"
- "File truncated or corrupted"
- "Socket connection closed by remote server"
- "Misuse of IO methods without proper checks for end-of-file condition"
solutions:
- "Add proper error handling for read operations"
- "Use conditional read methods that check for EOF (`read_nonblock` with exception: false)"
- "Implement retry logic for network operations"
- "Verify file integrity before reading"
- "For sockets, check connection status before attempting to read"
- "Add timeout handling for blocking IO operations"
ruby_type:
description: "Ruby type errors where operations are attempted on incompatible types, such as treating a non-module as a module or attempting operations not supported by a particular object type."
patterns:
- "TypeError:"
causes:
- "Performing operations on an object that doesn't support them"
- "Implicit type conversion failures"
- "Mixing incompatible types in operations"
- "Using methods that require specific object types"
- "Attempting to extend or include non-modules"
solutions:
- "Check object types before operating on them (using `is_a?` or `respond_to?`)"
- "Add explicit type conversions where needed"
- "Ensure methods are called on objects that support them"
- "Refactor code to handle different object types appropriately"
- "For extension/inclusion errors, ensure you're using a Module, not a Class"
ruby_runtime_exception:
description: "Generic runtime exceptions in Ruby code, representing a wide range of operational errors that occur during program execution rather than at parse time."
patterns:
- "RuntimeError"
causes:
- "Explicitly raised exceptions without specific type (`raise \"error\"`)"
- "Unexpected conditions during code execution"
- "Logic errors in the application flow"
- "Unhandled edge cases"
- "Resource allocation or permission issues"
solutions:
- "Check the specific error message to understand the cause"
- "Add more specific exception types rather than generic RuntimeError"
- "Improve error handling for edge cases"
- "Add defensive programming checks for potential error conditions"
- "Look for places where exceptions are being raised explicitly"
ruby_unknown_keyword:
description: "Method calls with unknown keyword arguments, usually due to API changes, typos in keyword names, or version mismatches between libraries."
patterns:
- "unknown keyword:"
causes:
- "Method API changed, removing previously supported keywords"
- "Typos in keyword argument names"
- "Using keyword arguments with methods that don't support them"
- "Library version mismatch with incompatible method signatures"
- "Missing required keyword arguments"
solutions:
- "Check method documentation for supported keyword arguments"
- "Review for typos in keyword names"
- "Update code to match changed APIs in newer versions"
- "Check for version mismatches in dependencies"
- "Ensure using the correct method signature"
ruby_wrong_number_of_arguments:
description: "Method calls with an incorrect number of arguments, either too few or too many. Usually caused by API changes or misunderstanding of method signatures."
patterns:
- "wrong number of arguments \\(gven"
causes:
- "Calling a method with too many or too few arguments"
- "API changes that modified method signatures"
- "Confusion between different method overloads"
- "Missing or extra required arguments"
- "Using positional arguments when keywords are expected or vice versa"
solutions:
- "Check method documentation for correct number of arguments"
- "Update method calls to match the expected signature"
- "For API changes, update code to conform to new signatures"
- "Make sure required arguments are provided"
- "Check if you're mixing positional and keyword arguments incorrectly"
ruby_bundler_command_failed:
description: "Failures when Bundler attempts to load and execute Ruby commands, often due to dependency issues, environment problems, or errors in the executed command itself."
patterns:
- "bundler: failed to load command: "
causes:
- "Missing gem dependencies"
- "Execution permission issues"
- "Errors in the script being executed"
- "Environment configuration problems"
- "Path or Ruby version mismatches"
solutions:
- "Run `bundle install` to ensure all dependencies are installed"
- "Check execution permissions on the command (`chmod +x` if needed)"
- "Review script for errors or compatibility issues"
- "Check Ruby version compatibility"
- "Ensure environment variables are correctly set"
- "Look for details in error traces following this message"
ruby_generic_failure:
description: "Generic Ruby errors that don't match more specific categories, typically shown in RSpec test failures or stack traces. Used as a fallback for Ruby errors not captured by other patterns."
patterns:
- "Failure/Error:"
- ":in `"
causes:
- "Various Ruby errors not covered by more specific categories"
- "Application-specific exceptions"
- "Test failures"
- "Logic errors in code"
- "Unexpected behaviors in dependencies"
solutions:
- "Examine the full error message and stack trace for specific causes"
- "Review the code at the location indicated in the stack trace"
- "Run failing tests locally with more verbose output"
- "Check recent changes that might have introduced the issue"
- "Review application logs for more context"
job_timeouts:
description: "CI/CD job execution timeouts, occurring when jobs run longer than their configured time limits (often 90 minutes for GitLab CI). These may indicate infinite loops, performance issues, or jobs that simply need more time."
patterns:
- "execution took longer than 1h30m0s seconds"
causes:
- "Tests or operations taking longer than the job timeout limit"
- "Infinite loops or deadlocks"
- "Resource contention slowing down execution"
- "Inefficient code or database queries"
- "Large data sets being processed without optimization"
solutions:
- "Optimize slow-running tests or operations"
- "Split long-running jobs into multiple smaller jobs"
- "Use parallelization to speed up test execution"
- "Fix infinite loops or deadlocks in the code"
- "Consider increasing job timeout if appropriate"
- "Add timeouts to potentially long-running operations"
rspec_at_80_min:
description: "RSpec test suite timeouts at the 80-minute mark, a specific limit set for GitLab's test suite to prevent excessively long-running tests. Test suites exceeding this limit are forcibly terminated."
patterns:
- "Rspec suite is exceeding the 80 minute limit and is forced to exit with error"
causes:
- "Test suite contains too many or too slow tests for the time limit"
- "Inefficient tests with unnecessary setup or operations"
- "Tests waiting on slow external resources"
- "Test ordering causing slow tests to run together"
- "Resource contention on CI runners"
solutions:
- "Optimize slow tests to improve execution time"
- "Split test files into smaller groups"
- "Use proper mocking and stubbing to avoid slow external calls"
- "Consider moving very slow tests to a separate job"
- "Profile test execution to identify bottlenecks"
- "Use parallelization with knapsack to distribute test load"
makefile:
description: "Failures in Makefile-based build processes, often occurring during compilation of C/C++ code, GitLab components like Gitaly, or when running make-based commands. The Error 1 indicates a non-zero exit status from a command."
patterns:
- "make: .+ Error 1"
causes:
- "Compilation errors in C/C++ code"
- "Missing dependencies required by the build"
- "Command referenced in Makefile not found or returning error"
- "Syntax errors in Makefile"
- "Permission issues preventing execution"
solutions:
- "Check compilation errors in the lines preceding this message"
- "Install missing dependencies required for the build"
- "Verify commands used in the Makefile exist and work correctly"
- "Check Makefile syntax and variable definitions"
- "Ensure proper permissions on files being built"
shell_unbound_variable:
description: "References to undefined shell variables in bash scripts, occurring when scripts attempt to use variables that haven't been set or have gone out of scope."
patterns:
- "unbound variable"
causes:
- "Using a variable that hasn't been defined"
- "Typo in variable name"
- "Environment variable expected but not set"
- "Variable set in a subshell but used in parent shell"
- "Missing `export` for variables meant to be available in child processes"
solutions:
- "Check for typos in variable names"
- "Ensure variables are defined before use"
- "Use default values with `${VAR:-default}` syntax"
- "Add error handling for missing variables"
- "Set `set -u` to catch unbound variables early"
- "For CI variables, ensure they're defined in settings"
shell_syntax:
description: "Shell script syntax errors, including malformed commands, missing quotes, incorrect control structures, or other bash syntax issues that prevent script execution."
patterns:
- ": syntax error"
causes:
- "Missing or unmatched quotes, parentheses, or brackets"
- "Invalid syntax in control structures (if, for, while)"
- "Incorrect command substitution"
- "Misplaced or missing semicolons"
- "Using bash features in a more restricted shell"
solutions:
- "Check for unmatched quotes, brackets, or parentheses"
- "Validate shell script syntax with a linter like shellcheck"
- "Use proper quoting for variables and expansions"
- "Ensure script is using the intended shell (bash, sh, etc.)"
- "Simplify complex expressions or break them into smaller parts"
shell_permission:
description: "Permission denied errors in shell commands, typically due to insufficient file access rights, attempting to write to read-only locations, or execute files without execute permissions."
patterns:
- ": Permission denied"
causes:
- "Insufficient file or directory permissions"
- "Attempting to write to a read-only filesystem"
- "Executing a script without the executable bit set"
- "User or CI runner lacks necessary permissions"
- "Attempting to access protected system resources"
solutions:
- "Check file permissions with `ls -l` and adjust with `chmod` if needed"
- "For scripts, ensure they have execute permission (`chmod +x script.sh`)"
- "Use a different directory with appropriate permissions"
- "Check if the CI runner has necessary permissions"
- "Run operations as appropriate user with proper privileges"
shell_file_not_found:
description: "Attempts to access files or directories that don't exist in shell commands, often due to incorrect paths, missing files, or failed file generation steps."
patterns:
- ": No such file or directory"
causes:
- "File or directory does not exist at the specified path"
- "Incorrect path used in command"
- "File was expected to be generated but wasn't"
- "File was deleted or moved before access"
- "Path typos or incorrect variable expansion"
solutions:
- "Verify file paths are correct and files exist"
- "Use absolute paths when relative paths might be ambiguous"
- "Check if previous steps that should generate the file completed successfully"
- "Ensure working directory is what you expect with `pwd`"
- "Debug by listing directory contents with `ls -la`"
shell_command_not_found:
description: "References to commands that don't exist or aren't in the system PATH, typically due to missing dependencies, uninstalled tools, or typos in command names."
patterns:
- ": command not found"
causes:
- "Command is not installed on the system"
- "Command is installed but not in the PATH"
- "Typo in command name"
- "Attempting to use an alias that isn't defined"
- "Missing dependency not installed in CI environment"
solutions:
- "Install the required command or package"
- "Check for typos in the command name"
- "Use full paths for commands in non-standard locations"
- "Add the command's directory to PATH"
- "Verify dependencies in CI configuration"
- "For Docker-based CI, ensure command is installed in the Docker image"
shell_not_in_function:
description: "Shell script errors related to function context, typically when using function-specific commands like 'return' outside of a function definition."
patterns:
- ": not in a function"
causes:
- "Using `return` statement outside of a function"
- "Function-specific constructs used in global scope"
- "Attempting to access function-local variables from outside"
- "Issues with bash script structure"
solutions:
- "Only use `return` inside function definitions"
- "Replace `return` with `exit` in top-level script context"
- "Ensure function definitions are correct (proper syntax)"
- "Restructure script to properly encapsulate functionality in functions"
- "Check for missing function definition or scope issues"
shell_readonly_variable:
description: "Attempts to modify read-only shell variables, which are protected from changes. Often seen with environment variables or constants that shouldn't be altered during execution."
patterns:
- "readonly variable"
causes:
- "Attempting to modify a variable declared with `readonly`"
- "Trying to change internal shell variables that are read-only"
- "Redefining environment variables that are protected"
- "Shell or system configuration that makes certain variables immutable"
solutions:
- "Avoid modifying readonly variables; use different variable names instead"
- "Check which variables are readonly using `readonly -p`"
- "Redesign script to work without modifying readonly variables"
- "For environment setup, set variables before they become readonly"
- "If necessary, create a subshell where variables can be redefined"
shell_could_not_gzip:
description: "Failures when attempting to compress files with gzip, particularly when the input stream ends unexpectedly. May indicate truncated files or interrupted streams."
patterns:
- "gzip: stdin: unexpected end of file"
causes:
- "Input file or stream is truncated or corrupt"
- "Pipe to gzip interrupted unexpectedly"
- "Disk space issues during compression"
- "Input source ended prematurely"
- "Network interruption during streaming"
solutions:
- "Verify input file integrity before compression"
- "Check for disk space issues"
- "Ensure input streams are complete before compression"
- "Add error handling for compression operations"
- "For pipelines, ensure upstream commands complete successfully"
io:
description: "Input/Output errors during file operations, network transfers, or device interactions. These indicate low-level problems with reading from or writing to resources."
patterns:
- "ERROR: .+ IO ERROR"
causes:
- "Disk or storage device failures"
- "Network interruptions during data transfer"
- "File system corruption"
- "Insufficient permissions for I/O operations"
- "Resource contention or locks preventing access"
solutions:
- "Check storage system health and available space"
- "Verify network connectivity for remote resources"
- "Ensure correct permissions for files and directories"
- "Add retry logic for transient I/O errors"
- "For CI runners, check if there are infrastructure issues"
could_not_curl:
description: "Failures when using curl to make HTTP requests, typically due to network issues, invalid URLs, or server errors. Often includes HTTP error codes that provide more specific information."
patterns:
- "curl.+The requested URL returned error"
causes:
- "Network connectivity issues"
- "Server returning HTTP error codes"
- "Invalid or malformed URLs"
- "DNS resolution failures"
- "Timeouts due to slow server response"
- "Server-side issues or maintenance"
solutions:
- "Check URL format and validity"
- "Verify network connectivity to the target server"
- "Look at the specific HTTP error code for more details"
- "For authentication errors, verify credentials"
- "Add retry logic with backoff for transient issues"
- "Check if the server or service is experiencing known issues"
ssl_connect_reset_by_peer:
description: "SSL connection reset errors during secure communications, often due to network interruptions, server-side SSL configuration issues, or certificate problems."
patterns:
- "Connection reset by peer - SSL_connect"
causes:
- "Network interruption during SSL handshake"
- "Server closed connection during negotiation"
- "SSL protocol version mismatch"
- "Cipher suite incompatibility"
- "Server-side SSL configuration issues"
- "Firewall or proxy interfering with SSL traffic"
solutions:
- "Check network stability and connectivity"
- "Verify SSL/TLS configuration on both client and server"
- "Try specifying compatible TLS version explicitly"
- "Add retry logic for transient connection issues"
- "Check for server-side SSL configuration changes"
- "Verify that firewalls or proxies allow SSL connections"
http:
description: "HTTP-related errors when making web requests, including client errors (4xx), server errors (5xx), and exceptions in HTTP client libraries. These indicate problems with API interactions or web service communications."
@ -167,22 +552,78 @@ failure_categories:
- "503 Service Unavailable"
- "Net::HTTPClientException"
- "Net::HTTPFatalError"
causes:
- "Invalid request format or parameters (4xx errors)"
- "Server-side issues or maintenance (5xx errors)"
- "Authentication or authorization failures"
- "Rate limiting or quota exceeded"
- "Network connectivity problems"
- "Server overload or unavailability"
solutions:
- "Check request format, parameters, and headers"
- "Verify authentication credentials and tokens"
- "For 5xx errors, wait and retry with exponential backoff"
- "Look for service status updates if persistent server errors"
- "Check API documentation for correct request format"
- "Implement circuit breakers for unreliable services"
failed_to_open_tcp_connection:
description: "Failures to establish TCP network connections, typically due to network issues, firewalls, incorrect hostnames/IPs, or services not running on the expected ports."
patterns:
- "Error: Failed to open TCP connection to "
causes:
- "Target service not running or listening on expected port"
- "Network connectivity issues"
- "Firewall blocking connection"
- "DNS resolution failures"
- "Incorrect hostname or IP address"
- "Service overloaded and rejecting connections"
solutions:
- "Verify the service is running on the target host and port"
- "Check network connectivity between client and server"
- "Verify hostname resolves to the correct IP address"
- "Check firewall rules to ensure connection is allowed"
- "Try an alternative endpoint if available"
- "Add retry logic with exponential backoff"
authentication_failures:
description: "Authentication failures when accessing protected resources, including Git repositories, Docker registries, or API endpoints. Usually due to invalid credentials, expired tokens, or insufficient permissions."
patterns:
- "fatal: Authentication failed for"
- "HTTP Basic: Access denied"
causes:
- "Invalid credentials (username/password or token)"
- "Expired access tokens"
- "Insufficient permissions for the requested operation"
- "Authentication method not supported or incorrect"
- "Two-factor authentication required but not provided"
- "Token revoked or invalidated"
solutions:
- "Verify credentials are correct and not expired"
- "Check if token has necessary permissions"
- "Generate a new token if current one might be invalid"
- "Ensure CI/CD variables are properly set and masked"
- "Verify the authentication method is supported"
- "Check organization access policies that might restrict access"
unknown_failure_canceled:
description: "Job cancellations with unclear causes, possibly due to manual cancellation, GitLab Runner interruptions, or system-level issues. These jobs are terminated before normal completion."
patterns:
- "ERROR: Job failed: canceled"
causes:
- "Manual job cancellation"
- "Runner shutdown or failure"
- "System resource constraints leading to termination"
- "Timeout at system or orchestration level"
- "Dependency job failure causing cancellation"
- "GitLab CI/CD system issues"
solutions:
- "Check if the job was manually canceled"
- "Look for system events that might have caused runner issues"
- "Check for resource constraints (CPU, memory, disk)"
- "Examine dependency jobs that might have triggered cancellation"
- "Retry the job to see if it was a transient issue"
- "Check GitLab status page for system-wide issues"
e2e_specs:
description: "End-to-end test failures specific to GitLab's QA framework, including failures to load the QA tools, failed readiness checks, or other issues with the end-to-end testing infrastructure."
@ -190,13 +631,50 @@ failure_categories:
- "failed to load command: bin/qa"
- "failed to load command: gitlab-qa"
- "QA::Tools::ReadinessCheck::ReadinessCheckError"
causes:
- "QA framework not properly installed or initialized"
- "Dependencies missing for QA tests"
- "Environment not properly set up for E2E testing"
- "Target instance not ready or accessible"
- "Issues with test environment configuration"
solutions:
- "Ensure QA dependencies are properly installed"
- "Check QA framework initialization and configuration"
- "Verify target GitLab instance is accessible and responsive"
- "Review readiness check logs to identify specific failures"
- "Check for recent changes to QA framework or test environment"
- "Run setup steps manually to debug environment issues"
e2e_lint:
description: "Linting issues in end-to-end tests, particularly related to testcase linking conventions that ensure proper documentation and traceability for tests."
patterns:
- "Testcase link violations detected"
causes:
- "Missing testcase links in E2E test files"
- "Incorrect format for testcase links"
- "Links pointing to non-existent testcases"
- "Multiple E2E tests referencing the same testcase"
- "Outdated testcase references"
solutions:
- "Add proper testcase links to E2E test files using correct format"
- "Verify testcase links point to valid, existing cases"
- "Ensure each test has a unique testcase reference"
- "Update outdated testcase references"
- "Follow E2E test documentation guidelines"
unexpected:
description: "Generic unexpected errors that don't match other categories, serving as a catch-all for miscellaneous issues. These often require manual investigation to determine the root cause."
patterns:
- "An unexpected error occurred"
causes:
- "Various unclassified errors"
- "Edge cases not handled by more specific error patterns"
- "Unusual environmental or configuration issues"
- "Multiple failures occurring simultaneously"
- "New or rare error conditions without specific patterns"
solutions:
- "Examine the full error logs for more specific information"
- "Try to reproduce the issue locally for better debugging"
- "Check recent changes that might have introduced the issue"
- "Look for environment-specific factors that might be relevant"
- "Consider adding a more specific error pattern if this occurs frequently"

View File

@ -14,6 +14,19 @@ failure_categories:
patterns:
- "Failed examples:,expected\\(:| # | \\[\\)"
- "Failed examples:,Failure/Error:"
causes:
- "Actual test failures due to code not meeting expectations"
- "Flaky tests that pass locally but fail intermittently in CI"
- "Race conditions in tests"
- "Time-dependent tests that are sensitive to execution speed"
- "Tests affected by state from other tests"
solutions:
- "Review the failure message to understand the specific expectation that's failing"
- "Run the specific failing test locally: `bin/rspec <file_path>:<line_number>`"
- "Check if the test is flaky by running it multiple times: `bin/rspec <file_path>:<line_number> --repeat 10`"
- "If the test is flaky, consider adding it to quarantine with the :quarantine tag"
- "For race conditions, ensure proper test isolation and avoid relying on execution order"
- "For consistent failures, fix the underlying code to match expectations or update the test if expectations have changed"
jest:
description: |
@ -25,6 +38,20 @@ failure_categories:
patterns:
- "Ran all test suites,Command failed with exit code 1"
- "Ran all test suites,exited with status 1"
causes:
- "JavaScript component doesn't match test expectations"
- "Snapshot tests are outdated after UI changes"
- "JavaScript syntax errors or runtime errors"
- "Mocked services or components not properly set up"
- "Tests timeout due to asynchronous operations not resolving"
- "Vue component lifecycle issues (especially with Vue 3 compatibility)"
solutions:
- "Run the specific failing test locally: `yarn jest <test_file> -t '<test_name>'`"
- "Update snapshots if UI has intentionally changed: `yarn jest -u <test_file>`"
- "Check for JavaScript syntax errors or missing dependencies"
- "Ensure mocks are properly set up and cleaned up between tests"
- "Add proper async/await handling for asynchronous operations"
- "For Vue 3 compatibility issues, check the Vue migration guide for breaking changes"
danger:
description: |
@ -43,3 +70,18 @@ failure_categories:
Danger failures should be addressed before merging as they help maintain code quality standards.
patterns:
- "DANGER_GITLAB_API_TOKEN,Errors:"
causes:
- "Commit message format doesn't follow guidelines (too long, missing reference, etc.)"
- "Missing changelog entry when one is required"
- "Documentation updates required but missing"
- "Database migration rules not followed"
- "Merge request is too large (exceeds recommended changes)"
- "Missing labels required for certain types of changes"
solutions:
- "Review specific errors in the Danger output to identify what needs to be fixed"
- "Fix commit messages to follow guidelines: https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines"
- "Add a changelog entry in the correct format and location"
- "Update documentation to reflect code changes"
- "Consider splitting large merge requests into smaller, focused changes"
- "Add required labels based on the type of change being made"
- "Run the danger-review job again after making changes"