Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2025-03-13 18:07:18 +00:00
parent aefada43de
commit 8ddf24b177
181 changed files with 4651 additions and 1195 deletions

View File

@ -2,18 +2,6 @@
# Cop supports --autocorrect.
Graphql/Descriptions:
Exclude:
- 'app/graphql/types/deployment_tag_type.rb'
- 'app/graphql/types/design_management/design_at_version_type.rb'
- 'app/graphql/types/design_management/design_fields.rb'
- 'app/graphql/types/diff_stats_type.rb'
- 'app/graphql/types/event_type.rb'
- 'app/graphql/types/group_type.rb'
- 'app/graphql/types/issue_type.rb'
- 'app/graphql/types/issues/negated_issue_filter_input_type.rb'
- 'app/graphql/types/merge_request_type.rb'
- 'app/graphql/types/merge_requests/interacts_with_merge_request.rb'
- 'app/graphql/types/milestone_sort_enum.rb'
- 'app/graphql/types/milestone_type.rb'
- 'app/graphql/types/namespace/package_settings_type.rb'
- 'app/graphql/types/notes/noteable_interface.rb'
- 'app/graphql/types/packages/cleanup/policy_type.rb'

View File

@ -1 +1 @@
5ba826bb0ae2842ea51fbfb42d6cdb5a0fd12f2f
3f3bfa812d4677b2f61884fb13aa5257707352c6

View File

@ -30,6 +30,11 @@ export default {
type: Boolean,
required: true,
},
defaultAwards: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
...mapGetters(['getUserData']),
@ -62,6 +67,7 @@ export default {
:awards="awards"
:can-award-emoji="canAwardEmoji"
:current-user-id="getUserData.id"
:default-awards="defaultAwards"
@award="handleAward($event)"
/>
</div>

View File

@ -3,7 +3,7 @@ import { escape } from 'lodash';
// eslint-disable-next-line no-restricted-imports
import { mapActions, mapGetters, mapState } from 'vuex';
import SafeHtml from '~/vue_shared/directives/safe_html';
import { __ } from '~/locale';
import { __, sprintf } from '~/locale';
import Suggestions from '~/vue_shared/components/markdown/suggestions.vue';
import { renderGFM } from '~/behaviors/markdown/render_gfm';
import NoteAttachment from './note_attachment.vue';
@ -107,6 +107,33 @@ export default {
return escape(suggestion);
},
isDuoFirstReviewComment() {
// Must be a Duo bot comment of type DiffNote
if (this.note.author.user_type !== 'duo_code_review_bot' || this.note.type !== 'DiffNote') {
return false;
}
// Get the discussion
const discussion = this.getDiscussion(this.note.discussion_id);
// If can't get discussion or this is not the first note, don't show feedback
return discussion?.notes?.length > 0 && discussion.notes[0].id === this.note.id;
},
defaultAwardsList() {
return this.isDuoFirstReviewComment ? ['thumbsup', 'thumbsdown'] : [];
},
duoFeedbackText() {
return sprintf(
__(
'Rate this response %{separator} %{codeStart}%{botUser}%{codeEnd} in reply for more questions',
),
{
separator: '•',
codeStart: '<code>',
botUser: '@GitLabDuo',
codeEnd: '</code>',
},
false,
);
},
},
watch: {
note: {
@ -226,13 +253,19 @@ export default {
:action-text="__('Edited')"
class="note_edited_ago"
/>
<div
v-if="isDuoFirstReviewComment"
v-safe-html:[$options.safeHtmlConfig]="duoFeedbackText"
class="gl-text-md gl-mt-4 gl-text-gray-500"
></div>
<note-awards-list
v-if="note.award_emoji && note.award_emoji.length"
v-if="isDuoFirstReviewComment || (note.award_emoji && note.award_emoji.length)"
:note-id="note.id"
:note-author-id="note.author.id"
:awards="note.award_emoji"
:toggle-award-path="note.toggle_award_path"
:can-award-emoji="note.current_user.can_award_emoji"
:default-awards="defaultAwardsList"
/>
<note-attachment v-if="note.attachment" :attachment="note.attachment" />
</div>

View File

@ -33,6 +33,7 @@ import {
SIGNATURE_BADGE_TOOLTIP,
DOCKER_MEDIA_TYPE,
OCI_MEDIA_TYPE,
MinimumAccessLevelText,
} from '../../constants/index';
import SignatureDetailsModal from './signature_details_modal.vue';
@ -172,10 +173,10 @@ export default {
return `${this.tag.name}_badge`;
},
accessLevelForDelete() {
return this.tag.protection?.minimumAccessLevelForDelete;
return MinimumAccessLevelText[this.tag.protection?.minimumAccessLevelForDelete];
},
accessLevelForPush() {
return this.tag.protection?.minimumAccessLevelForPush;
return MinimumAccessLevelText[this.tag.protection?.minimumAccessLevelForPush];
},
},
};
@ -216,10 +217,16 @@ export default {
<strong>{{ s__('ContainerRegistry|This tag is protected') }}</strong>
<br />
<br />
<strong>{{ s__('ContainerRegistry|Minimum role to push: ') }}</strong>
{{ accessLevelForPush }}
<strong>{{ s__('ContainerRegistry|Minimum role to delete: ') }}</strong>
{{ accessLevelForDelete }}
<ul class="gl-m-0 gl-list-none gl-p-0">
<li>
<strong>{{ s__('ContainerRegistry|Minimum role to push: ') }}</strong>
{{ accessLevelForPush }}
</li>
<li>
<strong>{{ s__('ContainerRegistry|Minimum role to delete: ') }}</strong>
{{ accessLevelForDelete }}
</li>
</ul>
</gl-popover>
</template>

View File

@ -177,3 +177,9 @@ export const PACKAGE_DELETE_HELP_PAGE_PATH = helpPagePath(
export const DOCKER_MEDIA_TYPE = 'application/vnd.docker.distribution.manifest.list.v2+json';
export const OCI_MEDIA_TYPE = 'application/vnd.oci.image.index.v1+json';
export const MinimumAccessLevelText = {
ADMIN: s__('AdminUsers|Administrator'),
MAINTAINER: __('Maintainer'),
OWNER: __('Owner'),
};

View File

@ -319,23 +319,25 @@ export default {
</template>
<template #cell(rowActions)="{ item }">
<gl-button
v-gl-tooltip
category="tertiary"
icon="pencil"
:title="$options.i18n.editIconButton"
:aria-label="$options.i18n.editIconButton"
@click="openEditFormDrawer(item)"
/>
<gl-button
v-gl-tooltip
v-gl-modal="$options.modal.id"
category="tertiary"
icon="remove"
:title="$options.i18n.deleteIconButton"
:aria-label="$options.i18n.deleteIconButton"
@click="showProtectionRuleDeletionConfirmModal(item)"
/>
<div class="gl-flex gl-justify-end">
<gl-button
v-gl-tooltip
category="tertiary"
icon="pencil"
:title="$options.i18n.editIconButton"
:aria-label="$options.i18n.editIconButton"
@click="openEditFormDrawer(item)"
/>
<gl-button
v-gl-tooltip
v-gl-modal="$options.modal.id"
category="tertiary"
icon="remove"
:title="$options.i18n.deleteIconButton"
:aria-label="$options.i18n.deleteIconButton"
@click="showProtectionRuleDeletionConfirmModal(item)"
/>
</div>
</template>
</gl-table>
<p v-else data-testid="empty-text" class="gl-text-subtle">

View File

@ -9,15 +9,15 @@ module Types
field :name,
GraphQL::Types::String,
description: 'Name of this git tag.'
description: 'Name of the git tag.'
field :path,
GraphQL::Types::String,
description: 'Path for this tag.'
description: 'Path for the tag.'
field :web_path,
GraphQL::Types::String,
description: 'Web path for this tag.'
description: 'Web path for the tag.'
end
# rubocop:enable Graphql/AuthorizeTypes
end

View File

@ -18,7 +18,7 @@ module Types
field :version,
Types::DesignManagement::VersionType,
null: false,
description: 'Version this design-at-versions is pinned to.'
description: 'Version the design-at-versions is pinned to.'
field :design,
Types::DesignManagement::DesignType,

View File

@ -7,7 +7,7 @@ module Types
field_class Types::BaseField
field :id, GraphQL::Types::ID, description: 'ID of this design.', null: false
field :id, GraphQL::Types::ID, description: 'ID of the design.', null: false
field :project, Types::ProjectType, null: false, description: 'Project the design belongs to.'
field :issue, Types::IssueType, null: false, description: 'Issue the design belongs to.'
field :filename, GraphQL::Types::String, null: false, description: 'Filename of the design.'
@ -23,16 +23,16 @@ module Types
null: false,
calls_gitaly: true,
extras: [:parent],
description: 'Diff refs for this design.'
description: 'Diff refs for the design.'
field :event, Types::DesignManagement::DesignVersionEventEnum,
null: false,
extras: [:parent],
description: 'How this design was changed in the current version.'
description: 'How the design was changed in the current version.'
field :notes_count,
GraphQL::Types::Int,
null: false,
method: :user_notes_count,
description: 'Total count of user-created notes for this design.'
description: 'Total count of user-created notes for the design.'
def diff_refs(parent:)
version = cached_stateful_version(parent)

View File

@ -9,9 +9,9 @@ module Types
description 'Changes to a single file'
field :additions, GraphQL::Types::Int, null: false,
description: 'Number of lines added to this file.'
description: 'Number of lines added to the file.'
field :deletions, GraphQL::Types::Int, null: false,
description: 'Number of lines deleted from this file.'
description: 'Number of lines deleted from the file.'
field :path, GraphQL::Types::String, null: false,
description: 'File path, relative to repository root.'

View File

@ -14,7 +14,7 @@ module Types
null: false
field :author, Types::UserType,
description: 'Author of this event.',
description: 'Author of the event.',
null: false
field :action, Types::EventActionEnum,
@ -22,19 +22,19 @@ module Types
null: false
field :created_at, Types::TimeType,
description: 'When this event was created.',
description: 'When the event was created.',
null: false
field :updated_at, Types::TimeType,
description: 'When this event was updated.',
description: 'When the event was updated.',
null: false
field :project, Types::ProjectType,
description: 'Project of this event.',
description: 'Project of the event.',
null: true
field :target, Types::Users::EventTargetType,
description: 'The target of the event',
description: 'Target of the event.',
calls_gitaly: true
def author

View File

@ -40,7 +40,7 @@ module Types
field :share_with_group_lock,
type: GraphQL::Types::Boolean,
null: true,
description: 'Indicates if sharing a project with another group within this group is prevented.'
description: 'Indicates if sharing a project with another group within the group is prevented.'
field :project_creation_level,
type: GraphQL::Types::String,
@ -57,7 +57,7 @@ module Types
field :require_two_factor_authentication,
type: GraphQL::Types::Boolean,
null: true,
description: 'Indicates if all users in this group are required to set up two-factor authentication.'
description: 'Indicates if all users in the group are required to set up two-factor authentication.'
field :two_factor_grace_period,
type: GraphQL::Types::Int,
@ -67,7 +67,7 @@ module Types
field :auto_devops_enabled,
type: GraphQL::Types::Boolean,
null: true,
description: 'Indicates whether Auto DevOps is enabled for all projects within this group.'
description: 'Indicates whether Auto DevOps is enabled for all projects within the group.'
field :emails_disabled,
type: GraphQL::Types::Boolean,
@ -81,7 +81,7 @@ module Types
field :max_access_level, Types::AccessLevelType,
null: false,
description: 'The maximum access level of the current user in the group.'
description: 'Maximum access level of the current user in the group.'
field :mentions_disabled,
type: GraphQL::Types::Boolean,
@ -139,7 +139,7 @@ module Types
field :label,
Types::LabelType,
null: true,
description: 'Label available on this group.' do
description: 'Label available on the group.' do
argument :title,
type: GraphQL::Types::String,
required: true,
@ -238,17 +238,17 @@ module Types
field :descendant_groups_count,
GraphQL::Types::Int,
null: false,
description: 'Count of direct descendant groups of this group.'
description: 'Count of direct descendant groups of the group.'
field :group_members_count,
GraphQL::Types::Int,
null: false,
description: 'Count of direct members of this group.'
description: 'Count of direct members of the group.'
field :projects_count,
GraphQL::Types::Int,
null: false,
description: 'Count of direct projects in this group.'
description: 'Count of direct projects in the group.'
field :pipeline_analytics, Types::Ci::AnalyticsType,
null: true,
@ -339,7 +339,7 @@ module Types
GraphQL::Types::Boolean,
null: true,
method: :math_rendering_limits_enabled?,
description: 'Indicates if math rendering limits are used for this group.'
description: 'Indicates if math rendering limits are used for the group.'
field :is_linked_to_subscription,
GraphQL::Types::Boolean,

View File

@ -126,7 +126,7 @@ module Types
description: 'Task completion status of the issue.'
field :design_collection, Types::DesignManagement::DesignCollectionType, null: true,
description: 'Collection of design images associated with this issue.'
description: 'Collection of design images associated with the issue.'
field :type, Types::IssueTypeEnum, null: true,
method: :issue_type,
@ -135,7 +135,7 @@ module Types
field :alert_management_alert,
Types::AlertManagement::AlertType,
null: true,
description: 'Alert associated to this issue.',
description: 'Alert associated to the issue.',
deprecated: { reason: 'Use `alert_management_alerts`', milestone: '15.6' }
field :alert_management_alerts,
@ -155,7 +155,7 @@ module Types
description: 'Updated Issue after it got moved to another project.'
field :closed_as_duplicate_of, Types::IssueType, null: true,
description: 'Issue this issue was closed as a duplicate of.'
description: 'Issue the issue was closed as a duplicate of.'
field :create_note_email, GraphQL::Types::String, null: true,
description: 'User specific email address for the issue.'

View File

@ -19,10 +19,10 @@ module Types
description: 'List of IIDs of issues to exclude. For example, `[1, 2]`.'
argument :label_name, [GraphQL::Types::String],
required: false,
description: 'Labels not applied to this issue.'
description: 'Labels not applied to the issue.'
argument :milestone_title, [GraphQL::Types::String],
required: false,
description: 'Milestone not applied to this issue.'
description: 'Milestone not applied to the issue.'
argument :milestone_wildcard_id, ::Types::NegatedMilestoneWildcardIdEnum,
required: false,
description: 'Filter by negated milestone wildcard values.'

View File

@ -25,9 +25,9 @@ module Types
field :diff_head_sha, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Diff head SHA of the merge request.'
field :diff_refs, Types::DiffRefsType, null: true,
description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.'
description: 'References of the base SHA, the head SHA, and the start SHA for the merge request.'
field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true,
description: 'Details about which files were changed in this merge request.' do
description: 'Details about which files were changed in the merge request.' do
argument :path, GraphQL::Types::String, required: false, description: 'Specific file path.'
end
field :draft, GraphQL::Types::Boolean, method: :draft?, null: false,
@ -75,7 +75,7 @@ module Types
field :default_squash_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default squash commit message of the merge request.'
field :diff_stats_summary, Types::DiffStatsSummaryType, null: true, calls_gitaly: true,
description: 'Summary of which files were changed in this merge request.'
description: 'Summary of which files were changed in the merge request.'
field :diverged_from_target_branch, GraphQL::Types::Boolean,
null: false, calls_gitaly: true,
method: :diverged_from_target_branch?,
@ -176,7 +176,7 @@ module Types
complexity: 5,
description: 'Assignees of the merge request.'
field :author, Types::MergeRequests::AuthorType, null: true,
description: 'User who created this merge request.'
description: 'User who created the merge request.'
field :discussion_locked, GraphQL::Types::Boolean,
description: 'Indicates if comments on the merge request are locked to members only.',
null: false
@ -215,7 +215,7 @@ module Types
complexity: 5,
description: 'Users from whom a review has been requested.'
field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5,
description: 'Indicates if the currently logged in user is subscribed to this merge request.'
description: 'Indicates if the currently logged in user is subscribed to the merge request.'
field :supports_lock_on_merge, GraphQL::Types::Boolean, null: false, method: :supports_lock_on_merge?,
description: 'Indicates if the merge request supports locked labels.'
field :task_completion_status, Types::TaskCompletionStatus, null: false,
@ -245,7 +245,7 @@ module Types
field :has_ci, GraphQL::Types::Boolean, null: false, method: :has_ci?,
description: 'Indicates if the merge request has CI.'
field :merge_user, Types::UserType, null: true,
description: 'User who merged this merge request or set it to auto-merge.'
description: 'User who merged the merge request or set it to auto-merge.'
field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true,
description: 'Indicates if the merge request is mergeable.'
field :security_auto_fix,

View File

@ -10,7 +10,7 @@ module Types
type: ::Types::UserMergeRequestInteractionType,
null: true,
extras: [:parent],
description: "Details of this user's interactions with the merge request."
description: "Details of the user's interactions with the merge request."
end
def merge_request_interaction(parent:, id: nil)

View File

@ -8,12 +8,12 @@ module Types
value 'DUE_DATE_ASC', 'Milestone due date by ascending order.', value: :due_date_asc
value 'DUE_DATE_DESC', 'Milestone due date by descending order.', value: :due_date_desc
value 'EXPIRED_LAST_DUE_DATE_ASC',
'Group milestones in this order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in ascending order.',
value: :expired_last_due_date_asc
value: :expired_last_due_date_asc,
description: 'Group milestones in the order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in ascending order.'
value 'EXPIRED_LAST_DUE_DATE_DESC',
'Group milestones in this order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in descending order.',
value: :expired_last_due_date_desc
value: :expired_last_due_date_desc,
description: 'Group milestones in the order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in descending order.'
end
end

View File

@ -70,7 +70,7 @@ module Types
field :releases, ::Types::ReleaseType.connection_type,
null: true,
description: 'Releases associated with this milestone.'
description: 'Releases associated with the milestone.'
def stats
milestone

View File

@ -76,10 +76,19 @@ module SnippetsHelper
tooltip = n_('%d file', '%d files', file_count) % file_count
tag.span(class: 'file_count', title: tooltip, data: { toggle: 'tooltip', container: 'body' }) do
concat(sprite_icon('documents', css_class: 'gl-align-middle'))
render Pajamas::ButtonComponent.new(
category: :tertiary,
size: :small,
icon: 'documents',
button_options: {
title: tooltip,
data: { toggle: 'tooltip', container: 'body' },
aria: { label: tooltip },
class: "file_count gl-min-h-0 gl-min-w-0 !gl-bg-transparent !gl-p-0"
}
) do
concat(' ')
concat(file_count)
concat(file_count.to_s)
end
end

View File

@ -65,6 +65,8 @@ module WebHooks
validates :interpolated_url, public_url: true, if: ->(hook) { hook.url_variables? && hook.errors.empty? }
validates :custom_headers, json_schema: { filename: 'web_hooks_custom_headers' }
validates :custom_webhook_template, length: { maximum: 4096 }
validates :name, length: { maximum: 255 }
validates :description, length: { maximum: 2048 }
enum :branch_filter_strategy, {
wildcard: 0,

View File

@ -23,6 +23,7 @@ class Packages::Conan::FileMetadatum < ApplicationRecord
PACKAGE_FILES = ::Gitlab::Regex::Packages::CONAN_PACKAGE_FILES
PACKAGE_BINARY = 'conan_package.tgz'
CONAN_MANIFEST = 'conanmanifest.txt'
CONANINFO_TXT = 'conaninfo.txt'
def recipe_revision_value
recipe_revision&.revision || DEFAULT_REVISION

View File

@ -34,6 +34,10 @@ module Packages
package_file.save!
end
if package_file.file_name == ::Packages::Conan::FileMetadatum::CONANINFO_TXT && Feature.enabled?(:parse_conan_metadata_on_upload, Project.actor_from_id(package_file.project_id))
::Packages::Conan::ProcessPackageFileWorker.perform_async(package_file.id)
end
ServiceResponse.success(payload: { package_file: package_file })
rescue ActiveRecord::RecordInvalid => e
ServiceResponse.error(message: e.message, reason: :invalid_package_file)

View File

@ -0,0 +1,113 @@
# frozen_string_literal: true
module Packages
module Conan
class MetadataExtractionService
include Gitlab::Utils::StrongMemoize
ExtractionError = Class.new(StandardError)
SECTION_HEADER_REGEX = /^\[(\w{1,50})\]$/
RECIPE_HASH_SECTION = 'recipe_hash'
ALLOWED_SECTIONS = %w[requires recipe_hash options settings].freeze
def initialize(package_file)
@package_file = package_file
end
def execute
result = parse_conaninfo_content
package_reference.update!(info: result)
ServiceResponse.success
rescue ActiveRecord::RecordInvalid => e
error_message = e.record.errors.full_messages.first
raise ExtractionError, "conaninfo.txt file too large" if error_message.include?("Info conaninfo is too large")
raise ExtractionError, "conaninfo.txt metadata failedto be saved: #{error_message}"
end
private
attr_reader :package_file
def parse_conaninfo_content
package_file.file.use_open_file(unlink_early: false) do |open_file|
parse_file_contents(File.open(open_file.file_path))
end
rescue StandardError => e
raise ExtractionError, "Error while parsing conaninfo.txt: #{e.message}"
end
def parse_file_contents(file)
result = {}
current_section = current_data = nil
file.each do |line|
line = line.strip
next if line.empty?
section_name = section_name_from(line)
if section_name
if current_section && current_data && allowed_section?(current_section)
result[current_section] = current_data
end
current_section = section_name
current_data = nil
elsif current_section && allowed_section?(current_section)
validate_recipe_hash_section(current_section, current_data)
current_data = process_section_line(current_section, line, current_data)
end
end
result[current_section] = current_data if current_section && current_data && allowed_section?(current_section)
result
end
def validate_recipe_hash_section(section, data)
return unless section == RECIPE_HASH_SECTION && data
raise ExtractionError, 'The recipe_hash section cannot have multiple lines'
end
def process_section_line(section, line, data)
return line if section == RECIPE_HASH_SECTION
return process_key_value_line(line, data) if line.include?('=')
process_array_line(line, data)
end
def process_key_value_line(line, data)
data ||= {}
key, value = line.split('=', 2).map(&:strip)
raise ExtractionError, "Invalid key-value line: #{line}" if key.empty? || value.empty?
data[key] = value
data
end
def process_array_line(line, data)
data ||= []
data << line
end
def allowed_section?(section)
strong_memoize_with(:allowed_section, section) do
ALLOWED_SECTIONS.include?(section)
end
end
def section_name_from(line)
section = line.match(SECTION_HEADER_REGEX)&.captures&.first
raise ExtractionError, "Invalid section header: #{line}" if section.nil? && line.start_with?('[')
section
end
def package_reference
package_file.conan_file_metadatum.package_reference
end
end
end
end

View File

@ -1,33 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Conan Info Schema",
"oneOf": [
{
"type": "object",
"additionalProperties": false
"type": "object",
"properties": {
"recipe_hash": {
"type": "string"
},
{
"settings": {
"type": "object",
"properties": {
"settings": {
"type": "object"
},
"requires": {
"type": "array",
"items": {
"type": "string"
}
},
"options": {
"type": "object"
}
},
"required": [
"settings",
"requires",
"options"
],
"additionalProperties": true
"additionalProperties": {
"type": "string"
}
},
"options": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"requires": {
"type": "array",
"items": {
"type": "string"
}
}
]
}
}

View File

@ -12,7 +12,7 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
```
cd existing_repo

View File

@ -26,12 +26,11 @@
= _('created %{timeAgo} by %{author}').html_safe % { timeAgo: created_at, author: author }
.sm:gl-flex.gl-flex-col.gl-items-end{ data: { testid: 'snippet-file-count-content', qa_snippet_files: snippet.statistics&.file_count } }
.gl-flex.gl-gap-4.gl-items-center
.gl-flex.gl-gap-3.gl-items-center
- if notes_count > 0
%span.has-tooltip{ title: _('Comments') }
= sprite_icon('comments')
= render Pajamas::ButtonComponent.new(category: :tertiary, size: :small, icon: 'comments', button_options: { class: 'has-tooltip !gl-bg-transparent !gl-p-0', title: _('Comments'), aria: { label: _('Comments') } }) do
= notes_count
= snippet_file_count(snippet)
%span.has-tooltip{ title: visibility_level_label(snippet.visibility_level), data: { testid: 'snippet-visibility-content', qa_snippet_visibility: visibility_level_label(snippet.visibility_level) } }
= render Pajamas::ButtonComponent.new(category: :tertiary, size: :small, button_options: { class: 'has-tooltip !gl-bg-transparent !gl-p-0', title: _(visibility_level_label(snippet.visibility_level)), aria: { label: _(snippet.visibility_level) }, data: { testid: 'snippet-visibility-content', qa_snippet_visibility: visibility_level_label(snippet.visibility_level) } }) do
= visibility_level_icon(snippet.visibility_level)
.gl-whitespace-nowrap.gl-text-sm.gl-text-subtle= _('updated %{timeAgo}').html_safe % { timeAgo: time_ago_with_tooltip(snippet.updated_at, placement: 'bottom') }

View File

@ -2134,6 +2134,16 @@
:tags:
- :cronjob_child
:queue_namespace: :package_cleanup
- :name: package_repositories:packages_conan_process_package_file
:worker_name: Packages::Conan::ProcessPackageFileWorker
:feature_category: :package_registry
:has_external_dependencies: false
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
:queue_namespace: :package_repositories
- :name: package_repositories:packages_debian_generate_distribution
:worker_name: Packages::Debian::GenerateDistributionWorker
:feature_category: :package_registry

View File

@ -17,7 +17,8 @@ module Packages
::Packages::Rubygems::ProcessGemService::ExtractionError,
::Packages::Rubygems::ProcessGemService::InvalidMetadataError,
::Packages::Npm::ProcessPackageFileService::ExtractionError,
::Packages::Npm::CheckManifestCoherenceService::MismatchError
::Packages::Npm::CheckManifestCoherenceService::MismatchError,
::Packages::Conan::MetadataExtractionService::ExtractionError
].freeze
def process_package_file_error(package_file:, exception:, extra_log_payload: {})

View File

@ -0,0 +1,31 @@
# frozen_string_literal: true
module Packages
module Conan
class ProcessPackageFileWorker
include ApplicationWorker
data_consistency :sticky
queue_namespace :package_repositories
feature_category :package_registry
deduplicate :until_executed
idempotent!
def perform(package_file_id)
package_file = ::Packages::PackageFile.find_by_id(package_file_id)
return unless package_file
::Packages::Conan::MetadataExtractionService.new(package_file).execute
rescue StandardError => exception
logger.warn(
message: "Error processing conaninfo.txt file",
error: exception.message,
package_file: package_file.id,
project_id: package_file.project_id,
package_name: package_file.package.name,
package_version: package_file.package.version
)
end
end
end
end

View File

@ -0,0 +1,9 @@
---
name: parse_conan_metadata_on_upload
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/33892
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/178728
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/523693
milestone: '17.10'
group: group::package registry
type: gitlab_com_derisk
default_enabled: false

View File

@ -0,0 +1,9 @@
---
name: use_primary_and_secondary_stores_for_sessions
feature_issue_url: https://gitlab.com/gitlab-com/gl-infra/data-access/durability/team/-/issues/28
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175735
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/509337
milestone: '17.9'
group: group::durability
type: gitlab_com_derisk
default_enabled: false

View File

@ -0,0 +1,9 @@
---
name: use_primary_store_as_default_for_sessions
feature_issue_url: https://gitlab.com/gitlab-com/gl-infra/data-access/durability/team/-/issues/28
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175735
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/509338
milestone: '17.9'
group: group::durability
type: gitlab_com_derisk
default_enabled: false

View File

@ -979,6 +979,10 @@
- 1
- - vulnerabilities_archival_archive
- 1
- - vulnerabilities_archival_export_export
- 1
- - vulnerabilities_archival_export_purge
- 1
- - vulnerabilities_mark_dropped_as_resolved
- 1
- - vulnerabilities_namespace_historical_statistics_process_transfer_events

View File

@ -4,5 +4,5 @@ description: This migration copies runners from ci_runners to the new partitione
feature_category: runner
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166520
milestone: '17.8'
queued_migration_version: 20250103092422
queued_migration_version: 20241219100359
finalized_by: 20250113151324

View File

@ -0,0 +1,8 @@
---
migration_job_name: BackfillSnippetRepositoriesSnippetOrganizationId
description: Backfills sharding key `snippet_repositories.snippet_organization_id` from `snippets`.
feature_category: source_code_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175410
milestone: '17.10'
queued_migration_version: 20241211134715
finalized_by: # version of the migration that finalized this BBM

View File

@ -0,0 +1,8 @@
---
migration_job_name: BackfillSnippetRepositoriesSnippetProjectId
description: Backfills sharding key `snippet_repositories.snippet_project_id` from `snippets`.
feature_category: source_code_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175410
milestone: '17.10'
queued_migration_version: 20241211134710
finalized_by: # version of the migration that finalized this BBM

View File

@ -0,0 +1,8 @@
---
migration_job_name: BackfillSnippetUserMentionsSnippetOrganizationId
description: Backfills sharding key `snippet_user_mentions.snippet_organization_id` from `snippets`.
feature_category: source_code_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180836
milestone: '17.10'
queued_migration_version: 20250209004158
finalized_by: # version of the migration that finalized this BBM

View File

@ -0,0 +1,8 @@
---
migration_job_name: BackfillSnippetUserMentionsSnippetProjectId
description: Backfills sharding key `snippet_user_mentions.snippet_project_id` from `snippets`.
feature_category: source_code_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180836
milestone: '17.10'
queued_migration_version: 20250209004153
finalized_by: # version of the migration that finalized this BBM

View File

@ -4,5 +4,5 @@ description: Copy taggings data for the ci_runners table into the new sharded ci
feature_category: runner
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175578
milestone: '17.8'
queued_migration_version: 20241219100359
queued_migration_version: 20250103092422
finalized_by: 20250114135714

View File

@ -0,0 +1,8 @@
---
migration_job_name: RemoveOrphanedVulnerabilityNotesBatchedMigration
description: Removes orphaned Notes for which the Vulnerability no longer exists.
feature_category: vulnerability_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180624
milestone: '17.10'
queued_migration_version: 20250304184254
finalized_by: # version of the migration that finalized this BBM

View File

@ -0,0 +1,13 @@
---
table_name: projects_branch_rules_merge_request_approval_settings
classes:
- Projects::BranchRules::MergeRequestApprovalSetting
feature_categories:
- source_code_management
description: Contains merge request approval settings for a protected branch
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183679
milestone: '17.10'
gitlab_schema: gitlab_main_cell
sharding_key:
project_id: projects
table_size: small

View File

@ -28,3 +28,6 @@ desired_sharding_key:
table: snippets
sharding_key: organization_id
belongs_to: snippet
desired_sharding_key_migration_job_name:
- BackfillSnippetRepositoriesSnippetProjectId
- BackfillSnippetRepositoriesSnippetOrganizationId

View File

@ -29,3 +29,6 @@ desired_sharding_key:
table: snippets
sharding_key: organization_id
belongs_to: snippet
desired_sharding_key_migration_job_name:
- BackfillSnippetUserMentionsSnippetProjectId
- BackfillSnippetUserMentionsSnippetOrganizationId

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddSnippetProjectIdToSnippetRepositories < Gitlab::Database::Migration[2.2]
milestone '17.10'
def change
add_column :snippet_repositories, :snippet_project_id, :bigint
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddSnippetOrganizationIdToSnippetRepositories < Gitlab::Database::Migration[2.2]
milestone '17.10'
def change
add_column :snippet_repositories, :snippet_organization_id, :bigint
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddSnippetProjectIdToSnippetUserMentions < Gitlab::Database::Migration[2.2]
milestone '17.10'
def change
add_column :snippet_user_mentions, :snippet_project_id, :bigint
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddSnippetOrganizationIdToSnippetUserMentions < Gitlab::Database::Migration[2.2]
milestone '17.10'
def change
add_column :snippet_user_mentions, :snippet_organization_id, :bigint
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class IndexVulnerabilityArchivedRecordsOnArchiveIdAndId < Gitlab::Database::Migration[2.2]
INDEX_NAME = 'index_vulnerability_archived_records_on_archive_id_and_id'
disable_ddl_transaction!
milestone '17.10'
def up
add_concurrent_index :vulnerability_archived_records, %i[archive_id id], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :vulnerability_archived_records, INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class DropIndexFromVulnerabilityArchivedRecordsOnArchiveId < Gitlab::Database::Migration[2.2]
INDEX_NAME = 'index_vulnerability_archived_records_on_archive_id'
disable_ddl_transaction!
milestone '17.10'
def up
remove_concurrent_index_by_name :vulnerability_archived_records, INDEX_NAME
end
def down
add_concurrent_index :vulnerability_archived_records, :archive_id, name: INDEX_NAME
end
end

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class CreateProjectsBranchRulesMergeRequestApprovalSettings < Gitlab::Database::Migration[2.2]
milestone '17.10'
PROTECTED_BRANCH_INDEX = 'idx_branch_rules_mr_approval_settings_on_protected_branch_id'
PROJECT_INDEX = 'idx_branch_rules_mr_approval_settings_on_project_id'
def change
create_table :projects_branch_rules_merge_request_approval_settings do |t| # rubocop:disable Migration/EnsureFactoryForTable -- See https://gitlab.com/gitlab-org/gitlab/-/issues/504620
t.timestamps_with_timezone null: false
t.belongs_to :protected_branch, foreign_key: false, null: false, index: {
unique: true, name: PROTECTED_BRANCH_INDEX
}
t.belongs_to :project, foreign_key: false, null: false, index: { name: PROJECT_INDEX }
t.boolean :prevent_author_approval, default: false, null: false
t.boolean :prevent_committer_approval, default: false, null: false
t.boolean :prevent_editing_approval_rules, default: false, null: false
t.boolean :require_reauthentication_to_approve, default: false, null: false
t.integer :approval_removals, default: 1, null: false, limit: 2
end
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddFkToProjectsBranchRulesMergeRequestApprovalSettingsProtectedBranch < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.10'
def up
add_concurrent_foreign_key(
:projects_branch_rules_merge_request_approval_settings,
:protected_branches, column: :protected_branch_id,
on_delete: :cascade,
reverse_lock_order: true
)
end
def down
with_lock_retries do
remove_foreign_key_if_exists(
:projects_branch_rules_merge_request_approval_settings,
column: :protected_branch_id,
reverse_lock_order: true
)
end
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddFkToProjectsBranchRulesMergeRequestApprovalSettingsProject < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.10'
def up
add_concurrent_foreign_key(
:projects_branch_rules_merge_request_approval_settings,
:projects, column: :project_id,
on_delete: :cascade,
reverse_lock_order: true
)
end
def down
with_lock_retries do
remove_foreign_key_if_exists(
:projects_branch_rules_merge_request_approval_settings,
column: :project_id,
reverse_lock_order: true
)
end
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class IndexSnippetRepositoriesOnSnippetProjectId < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
INDEX_NAME = 'index_snippet_repositories_on_snippet_project_id'
def up
add_concurrent_index :snippet_repositories, :snippet_project_id, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :snippet_repositories, INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class AddSnippetRepositoriesSnippetProjectIdFk < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
def up
add_concurrent_foreign_key :snippet_repositories, :projects, column: :snippet_project_id, on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :snippet_repositories, column: :snippet_project_id
end
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class AddSnippetRepositoriesSnippetProjectIdTrigger < Gitlab::Database::Migration[2.2]
milestone '17.10'
def up
install_sharding_key_assignment_trigger(
table: :snippet_repositories,
sharding_key: :snippet_project_id,
parent_table: :snippets,
parent_sharding_key: :project_id,
foreign_key: :snippet_id
)
end
def down
remove_sharding_key_assignment_trigger(
table: :snippet_repositories,
sharding_key: :snippet_project_id,
parent_table: :snippets,
parent_sharding_key: :project_id,
foreign_key: :snippet_id
)
end
end

View File

@ -0,0 +1,40 @@
# frozen_string_literal: true
class QueueBackfillSnippetRepositoriesSnippetProjectId < Gitlab::Database::Migration[2.2]
milestone '17.10'
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
MIGRATION = "BackfillSnippetRepositoriesSnippetProjectId"
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1000
SUB_BATCH_SIZE = 100
def up
queue_batched_background_migration(
MIGRATION,
:snippet_repositories,
:snippet_id,
:snippet_project_id,
:snippets,
:project_id,
:snippet_id,
job_interval: DELAY_INTERVAL,
batch_size: BATCH_SIZE,
sub_batch_size: SUB_BATCH_SIZE
)
end
def down
delete_batched_background_migration(
MIGRATION,
:snippet_repositories,
:snippet_id,
[
:snippet_project_id,
:snippets,
:project_id,
:snippet_id
]
)
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class IndexSnippetRepositoriesOnSnippetOrganizationId < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
INDEX_NAME = 'index_snippet_repositories_on_snippet_organization_id'
def up
add_concurrent_index :snippet_repositories, :snippet_organization_id, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :snippet_repositories, INDEX_NAME
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddSnippetRepositoriesSnippetOrganizationIdFk < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
def up
add_concurrent_foreign_key :snippet_repositories, :organizations, column: :snippet_organization_id,
on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :snippet_repositories, column: :snippet_organization_id
end
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class AddSnippetRepositoriesSnippetOrganizationIdTrigger < Gitlab::Database::Migration[2.2]
milestone '17.10'
def up
install_sharding_key_assignment_trigger(
table: :snippet_repositories,
sharding_key: :snippet_organization_id,
parent_table: :snippets,
parent_sharding_key: :organization_id,
foreign_key: :snippet_id
)
end
def down
remove_sharding_key_assignment_trigger(
table: :snippet_repositories,
sharding_key: :snippet_organization_id,
parent_table: :snippets,
parent_sharding_key: :organization_id,
foreign_key: :snippet_id
)
end
end

View File

@ -0,0 +1,40 @@
# frozen_string_literal: true
class QueueBackfillSnippetRepositoriesSnippetOrganizationId < Gitlab::Database::Migration[2.2]
milestone '17.10'
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
MIGRATION = "BackfillSnippetRepositoriesSnippetOrganizationId"
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1000
SUB_BATCH_SIZE = 100
def up
queue_batched_background_migration(
MIGRATION,
:snippet_repositories,
:snippet_id,
:snippet_organization_id,
:snippets,
:organization_id,
:snippet_id,
job_interval: DELAY_INTERVAL,
batch_size: BATCH_SIZE,
sub_batch_size: SUB_BATCH_SIZE
)
end
def down
delete_batched_background_migration(
MIGRATION,
:snippet_repositories,
:snippet_id,
[
:snippet_organization_id,
:snippets,
:organization_id,
:snippet_id
]
)
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class IndexSnippetUserMentionsOnSnippetProjectId < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
INDEX_NAME = 'index_snippet_user_mentions_on_snippet_project_id'
def up
add_concurrent_index :snippet_user_mentions, :snippet_project_id, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :snippet_user_mentions, INDEX_NAME
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class AddSnippetUserMentionsSnippetProjectIdFk < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
def up
add_concurrent_foreign_key :snippet_user_mentions, :projects, column: :snippet_project_id, on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :snippet_user_mentions, column: :snippet_project_id
end
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class AddSnippetUserMentionsSnippetProjectIdTrigger < Gitlab::Database::Migration[2.2]
milestone '17.10'
def up
install_sharding_key_assignment_trigger(
table: :snippet_user_mentions,
sharding_key: :snippet_project_id,
parent_table: :snippets,
parent_sharding_key: :project_id,
foreign_key: :snippet_id
)
end
def down
remove_sharding_key_assignment_trigger(
table: :snippet_user_mentions,
sharding_key: :snippet_project_id,
parent_table: :snippets,
parent_sharding_key: :project_id,
foreign_key: :snippet_id
)
end
end

View File

@ -0,0 +1,40 @@
# frozen_string_literal: true
class QueueBackfillSnippetUserMentionsSnippetProjectId < Gitlab::Database::Migration[2.2]
milestone '17.10'
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
MIGRATION = "BackfillSnippetUserMentionsSnippetProjectId"
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1000
SUB_BATCH_SIZE = 100
def up
queue_batched_background_migration(
MIGRATION,
:snippet_user_mentions,
:id,
:snippet_project_id,
:snippets,
:project_id,
:snippet_id,
job_interval: DELAY_INTERVAL,
batch_size: BATCH_SIZE,
sub_batch_size: SUB_BATCH_SIZE
)
end
def down
delete_batched_background_migration(
MIGRATION,
:snippet_user_mentions,
:id,
[
:snippet_project_id,
:snippets,
:project_id,
:snippet_id
]
)
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class IndexSnippetUserMentionsOnSnippetOrganizationId < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
INDEX_NAME = 'index_snippet_user_mentions_on_snippet_organization_id'
def up
add_concurrent_index :snippet_user_mentions, :snippet_organization_id, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :snippet_user_mentions, INDEX_NAME
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddSnippetUserMentionsSnippetOrganizationIdFk < Gitlab::Database::Migration[2.2]
milestone '17.10'
disable_ddl_transaction!
def up
add_concurrent_foreign_key :snippet_user_mentions, :organizations, column: :snippet_organization_id,
on_delete: :cascade
end
def down
with_lock_retries do
remove_foreign_key :snippet_user_mentions, column: :snippet_organization_id
end
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class AddSnippetUserMentionsSnippetOrganizationIdTrigger < Gitlab::Database::Migration[2.2]
milestone '17.10'
def up
install_sharding_key_assignment_trigger(
table: :snippet_user_mentions,
sharding_key: :snippet_organization_id,
parent_table: :snippets,
parent_sharding_key: :organization_id,
foreign_key: :snippet_id
)
end
def down
remove_sharding_key_assignment_trigger(
table: :snippet_user_mentions,
sharding_key: :snippet_organization_id,
parent_table: :snippets,
parent_sharding_key: :organization_id,
foreign_key: :snippet_id
)
end
end

View File

@ -0,0 +1,40 @@
# frozen_string_literal: true
class QueueBackfillSnippetUserMentionsSnippetOrganizationId < Gitlab::Database::Migration[2.2]
milestone '17.10'
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
MIGRATION = "BackfillSnippetUserMentionsSnippetOrganizationId"
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1000
SUB_BATCH_SIZE = 100
def up
queue_batched_background_migration(
MIGRATION,
:snippet_user_mentions,
:id,
:snippet_organization_id,
:snippets,
:organization_id,
:snippet_id,
job_interval: DELAY_INTERVAL,
batch_size: BATCH_SIZE,
sub_batch_size: SUB_BATCH_SIZE
)
end
def down
delete_batched_background_migration(
MIGRATION,
:snippet_user_mentions,
:id,
[
:snippet_organization_id,
:snippets,
:organization_id,
:snippet_id
]
)
end
end

View File

@ -0,0 +1,27 @@
# frozen_string_literal: true
class QueueRemoveOrphanedVulnerabilityNotesBatchedMigration < Gitlab::Database::Migration[2.2]
milestone '17.10'
restrict_gitlab_migration gitlab_schema: :gitlab_main
MIGRATION = "RemoveOrphanedVulnerabilityNotesBatchedMigration"
DELAY_INTERVAL = 2.minutes
BATCH_SIZE = 1000
SUB_BATCH_SIZE = 100
def up
queue_batched_background_migration(
MIGRATION,
:notes,
:id,
job_interval: DELAY_INTERVAL,
batch_size: BATCH_SIZE,
sub_batch_size: SUB_BATCH_SIZE
)
end
def down
delete_batched_background_migration(MIGRATION, :notes, :id, [])
end
end

View File

@ -1,50 +1,14 @@
# frozen_string_literal: true
class SwitchRecordChangeTrackingToPCiRunnerMachinesTable < Gitlab::Database::Migration[2.2]
include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
disable_ddl_transaction!
milestone '17.10'
PARTITIONED_TABLE = :ci_runner_machines
TABLES = %i[
instance_type_ci_runner_machines group_type_ci_runner_machines project_type_ci_runner_machines ci_runner_machines
].freeze
def up
# Remove current LFK trigger that is currently assigned to ci_runner_machines_archived, due to the call to
# replace_with_partitioned_table:
# CREATE TRIGGER ci_runner_machines_loose_fk_trigger AFTER DELETE ON ci_runner_machines_archived
# REFERENCING OLD TABLE AS old_table
# FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
drop_trigger(:ci_runner_machines_archived, :ci_runner_machines_loose_fk_trigger, if_exists: true)
# Reattaching the new trigger function to the existing partitioned tables
# but with an overridden table name
TABLES.each do |table|
with_lock_retries do
untrack_record_deletions(table)
track_record_deletions_override_table_name(table, PARTITIONED_TABLE)
end
end
# no-op due to https://gitlab.com/gitlab-com/gl-infra/production/-/issues/19476, retried in
# RetrySwitchRecordChangeTrackingToPCiRunnerMachinesTable
end
def down
TABLES.each do |table|
with_lock_retries do
untrack_record_deletions(table)
end
end
# Mimic track_record_deletions but in a way to restore the previous state
# (i.e. trigger on ci_runner_machines_archived but still named ci_runner_machines_loose_fk_trigger)
execute(<<~SQL.squish)
CREATE TRIGGER #{record_deletion_trigger_name(PARTITIONED_TABLE)}
AFTER DELETE ON ci_runner_machines_archived REFERENCING OLD TABLE AS old_table
FOR EACH STATEMENT
EXECUTE FUNCTION #{INSERT_FUNCTION_NAME}();
SQL
# no-op
end
end

View File

@ -0,0 +1,56 @@
# frozen_string_literal: true
class RetrySwitchRecordChangeTrackingToPCiRunnerMachinesTable < Gitlab::Database::Migration[2.2]
include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
disable_ddl_transaction!
milestone '17.10'
PARTITIONED_TABLE = :ci_runner_machines
TABLES = %i[
instance_type_ci_runner_machines group_type_ci_runner_machines project_type_ci_runner_machines ci_runner_machines
].freeze
def up
# Remove current LFK trigger that is currently assigned to ci_runner_machines_archived, due to the call to
# replace_with_partitioned_table:
# CREATE TRIGGER ci_runner_machines_loose_fk_trigger AFTER DELETE ON ci_runner_machines_archived
# REFERENCING OLD TABLE AS old_table
# FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
with_lock_retries do
# rubocop:disable Migration/WithLockRetriesDisallowedMethod -- false positive
drop_trigger(:ci_runner_machines_archived, :ci_runner_machines_loose_fk_trigger)
# rubocop:enable Migration/WithLockRetriesDisallowedMethod
end
# Reattaching the new trigger function to the existing partitioned tables
# but with an overridden table name
TABLES.each do |table|
with_lock_retries do
untrack_record_deletions(table)
track_record_deletions_override_table_name(table, PARTITIONED_TABLE)
end
end
end
def down
TABLES.each do |table|
with_lock_retries do
untrack_record_deletions(table)
end
end
# Mimic track_record_deletions but in a way to restore the previous state
# (i.e. trigger on ci_runner_machines_archived but still named ci_runner_machines_loose_fk_trigger)
with_lock_retries do
execute(<<~SQL.squish)
CREATE TRIGGER #{record_deletion_trigger_name(PARTITIONED_TABLE)}
AFTER DELETE ON ci_runner_machines_archived REFERENCING OLD TABLE AS old_table
FOR EACH STATEMENT
EXECUTE FUNCTION #{INSERT_FUNCTION_NAME}();
SQL
end
end
end

View File

@ -0,0 +1 @@
48f5f852380a7a3e179c913568219ae8799b32c9b59c0f3219be6dc31a45332b

View File

@ -0,0 +1 @@
4a3a2de5da48f40751d6b7bacb5a4081954eda13a31f535e0e65c17c821c2e3a

View File

@ -0,0 +1 @@
d3b3fd1a860be5e1fcf4b1ed8a645d350c9527601db2bf9d0cc5cf8872382026

View File

@ -0,0 +1 @@
035aea2280dca568860cf636727798b9f2a0d98669d8302d12ed8183f07035c7

View File

@ -0,0 +1 @@
38438dced134d7c7bf46dc0bb955f566c4edaebe6bd47b9a4b7d39027c2f0e98

View File

@ -0,0 +1 @@
7bcb615592724e6a9b499293e5e4eb48daab5a867499a707735fbe336c46b78e

View File

@ -0,0 +1 @@
e53745adeacf8ec8b3ca1f343927942093bdfbccb76d56ac90b4728f967bf7c8

View File

@ -0,0 +1 @@
22d6304d4124f9353db4c409c7a30c7b8bc4536233cb7f388706111f0ca48515

View File

@ -0,0 +1 @@
841b185889673d3293c949d91a53baf5501109846d0b2d625d50c2582fe610f2

View File

@ -0,0 +1 @@
4af7bbac18c391a5168bc68fbc53e046884f848c25d8c217aae397a37e52fe80

View File

@ -0,0 +1 @@
2b7d3200dbb39701dc29899fa9a91cb8fd6f4524c2dd18fa83809f3986000eb6

View File

@ -0,0 +1 @@
889bd985841d24ba0726a7401e8bc41f8d85469c3c7ab70299eef09121203a9a

View File

@ -0,0 +1 @@
fbdf2c73b97679360386e74734f0be035f64bfc15abe62ff45fb761fb640568f

View File

@ -0,0 +1 @@
ac9d9f71b29435b1283b52cc8bf0f90a1e6ff456fd4003e84152096a17ebfaab

View File

@ -0,0 +1 @@
707bb0c8657cd871427511c75efdc70e8745e8d38b9cf7491cb78e5e132b9452

View File

@ -0,0 +1 @@
b9a499b4bfcd8933f92cf9e1f66da493e615d1cff94233271a280d4506ad6287

View File

@ -0,0 +1 @@
cc669986d1c2e8896173e076c846a65e1bbe7d0fd4c438d80b90d3515d0d036f

View File

@ -0,0 +1 @@
398980e7624f9591314c8117929c02c65a259a29f00c662e737b94429739c309

View File

@ -0,0 +1 @@
38c5a2c2fb5e72a01c6b8004076f62b51403fefd0c9e4014ab7bfcad7db7ab98

View File

@ -0,0 +1 @@
60c6ea7a1a479512f661ae542f430f1ddb6abe30a57bb2a301de4ef4e9bfed53

View File

@ -0,0 +1 @@
22c4e9ded5b0474d1854de01a1b363394df170e63fc05b0a1b8d968aaa891505

View File

@ -0,0 +1 @@
6d2337f6c66588dfe3d7e3f6fa2b0cf73160a2a0256b28cefb1f58f54c88adfb

View File

@ -0,0 +1 @@
0c6eba6946c0434d649293804a2ab50c0f45590ca9d583435aa0aea05a668b9d

View File

@ -0,0 +1 @@
3c998c5fb4772cdd55ce6018628cc76189793c2d4afd03de2a9affa98d0025a8

View File

@ -0,0 +1 @@
14cea79c56bcb50b665936feecc18a8e45154ef969c75be8a1fb107aea60a6be

View File

@ -0,0 +1 @@
8c66743c43a7f6afafc73c723a6baf2a53597c1a49c50ceff45b10d7f88460de

Some files were not shown because too many files have changed in this diff Show More