Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-26 00:08:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-26 00:08:32 +0300
commitaadc5da1b1ccba52944e6df0f2173fad5d3fe675 (patch)
tree3b43f157e9117be6713fc0c79014878e06308c6e
parent0599ea8fb389d70cab67a78e80d61eadc6aeaaff (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.rubocop_todo/layout/line_length.yml3
-rw-r--r--app/assets/javascripts/projects/compare/components/app.vue20
-rw-r--r--app/assets/javascripts/projects/compare/index.js12
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util.js2
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/package_json_linker.js13
-rw-r--r--app/controllers/concerns/creates_commit.rb3
-rw-r--r--app/controllers/projects/compare_controller.rb2
-rw-r--r--app/controllers/search_controller.rb1
-rw-r--r--app/helpers/compare_helper.rb57
-rw-r--r--app/helpers/merge_requests_helper.rb19
-rw-r--r--app/models/concerns/enums/sbom.rb13
-rw-r--r--app/views/events/event/_push.html.haml7
-rw-r--r--app/views/projects/_last_push.html.haml6
-rw-r--r--app/views/projects/branches/_branch.html.haml4
-rw-r--r--app/views/projects/commits/show.html.haml5
-rw-r--r--app/views/projects/issues/_new_branch.html.haml3
-rw-r--r--config/initializers/database_query_analyzers.rb8
-rw-r--r--db/post_migrate/20220720121421_remove_pat_and_ssh_enforcement_columns_from_application_settings.rb8
-rw-r--r--db/schema_migrations/202207201214211
-rw-r--r--db/structure.sql2
-rw-r--r--doc/development/database/multiple_databases.md2
-rw-r--r--doc/development/fips_compliance.md8
-rw-r--r--lib/gitlab/ci/parsers/sbom/cyclonedx.rb56
-rw-r--r--lib/gitlab/ci/reports/sbom/component.rb19
-rw-r--r--lib/gitlab/ci/reports/sbom/report.rb31
-rw-r--r--lib/gitlab/ci/reports/sbom/source.rb19
-rw-r--r--lib/tasks/gitlab/tw/codeowners.rake2
-rw-r--r--package.json2
-rw-r--r--spec/controllers/projects/blob_controller_spec.rb1
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb1
-rw-r--r--spec/controllers/search_controller_spec.rb13
-rw-r--r--spec/features/projects/merge_request_button_spec.rb20
-rw-r--r--spec/frontend/projects/compare/components/app_spec.js3
-rw-r--r--spec/frontend/projects/compare/components/mock_data.js25
-rw-r--r--spec/frontend/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util_spec.js5
-rw-r--r--spec/lib/gitlab/background_migration/backfill_ci_namespace_mirrors_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/backfill_ci_project_mirrors_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/backfill_ci_queuing_tables_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/backfill_projects_with_coverage_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/drop_invalid_security_findings_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/migrate_project_taggings_context_from_tags_to_topics_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb7
-rw-r--r--spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb2
-rw-r--r--spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb3
-rw-r--r--spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb3
-rw-r--r--spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb90
-rw-r--r--spec/lib/gitlab/ci/reports/sbom/component_spec.rb23
-rw-r--r--spec/lib/gitlab/ci/reports/sbom/report_spec.rb65
-rw-r--r--spec/lib/gitlab/ci/reports/sbom/source_spec.rb31
-rw-r--r--spec/lib/gitlab/database/bulk_update_spec.rb3
-rw-r--r--spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb6
-rw-r--r--spec/lib/gitlab/database/load_balancing_spec.rb2
-rw-r--r--spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb7
-rw-r--r--spec/lib/gitlab/database/migration_helpers_spec.rb2
-rw-r--r--spec/lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection_spec.rb25
-rw-r--r--spec/lib/gitlab/usage/service_ping_report_spec.rb8
-rw-r--r--spec/lib/marginalia_spec.rb16
-rw-r--r--spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb2
-rw-r--r--spec/migrations/20210818185845_backfill_projects_with_coverage_spec.rb2
-rw-r--r--spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb3
-rw-r--r--spec/migrations/20220124130028_dedup_runner_projects_spec.rb2
-rw-r--r--spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb2
-rw-r--r--spec/migrations/associate_existing_dast_builds_with_variables_spec.rb2
-rw-r--r--spec/migrations/clean_up_pending_builds_table_spec.rb2
-rw-r--r--spec/migrations/delete_security_findings_without_uuid_spec.rb2
-rw-r--r--spec/migrations/disable_job_token_scope_when_unused_spec.rb2
-rw-r--r--spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb2
-rw-r--r--spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb3
-rw-r--r--spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb2
-rw-r--r--spec/migrations/schedule_populate_status_column_of_security_scans_spec.rb2
-rw-r--r--spec/migrations/start_backfill_ci_queuing_tables_spec.rb2
-rw-r--r--spec/support/database/gitlab_schemas_validate_connection.rb17
-rw-r--r--spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb18
-rw-r--r--spec/support_specs/database/prevent_cross_joins_spec.rb2
-rw-r--r--spec/tasks/gitlab/background_migrations_rake_spec.rb4
-rw-r--r--spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb3
-rw-r--r--spec/tasks/gitlab/db/lock_writes_rake_spec.rb3
-rw-r--r--spec/tasks/gitlab/db/validate_config_rake_spec.rb2
-rw-r--r--spec/workers/database/batched_background_migration/ci_database_worker_spec.rb2
-rw-r--r--spec/workers/database/batched_background_migration_worker_spec.rb2
-rw-r--r--yarn.lock8
83 files changed, 644 insertions, 160 deletions
diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml
index 7d2674c34f8..1d5537bb608 100644
--- a/.rubocop_todo/layout/line_length.yml
+++ b/.rubocop_todo/layout/line_length.yml
@@ -801,7 +801,6 @@ Layout/LineLength:
- 'config/initializers/active_record_transaction_observer.rb'
- 'config/initializers/carrierwave_patch.rb'
- 'config/initializers/content_security_policy.rb'
- - 'config/initializers/database_query_analyzers.rb'
- 'config/initializers/deprecations.rb'
- 'config/initializers/devise_dynamic_password_length_validation.rb'
- 'config/initializers/direct_upload_support.rb'
@@ -4749,7 +4748,6 @@ Layout/LineLength:
- 'spec/lib/gitlab/background_migration/migrate_merge_request_diff_commit_users_spec.rb'
- 'spec/lib/gitlab/background_migration/migrate_personal_namespace_project_maintainer_to_owner_spec.rb'
- 'spec/lib/gitlab/background_migration/move_container_registry_enabled_to_project_feature_spec.rb'
- - 'spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb'
- 'spec/lib/gitlab/background_migration/populate_container_repository_migration_plan_spec.rb'
- 'spec/lib/gitlab/background_migration/populate_vulnerability_reads_spec.rb'
- 'spec/lib/gitlab/background_migration/project_namespaces/backfill_project_namespaces_spec.rb'
@@ -4858,7 +4856,6 @@ Layout/LineLength:
- 'spec/lib/gitlab/database/batch_count_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/configuration_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/host_list_spec.rb'
- - 'spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/setup_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/sidekiq_client_middleware_spec.rb'
diff --git a/app/assets/javascripts/projects/compare/components/app.vue b/app/assets/javascripts/projects/compare/components/app.vue
index bda58091b97..4ba7156b026 100644
--- a/app/assets/javascripts/projects/compare/components/app.vue
+++ b/app/assets/javascripts/projects/compare/components/app.vue
@@ -15,7 +15,11 @@ export default {
type: String,
required: true,
},
- refsProjectPath: {
+ sourceProjectRefsPath: {
+ type: String,
+ required: true,
+ },
+ targetProjectRefsPath: {
type: String,
required: true,
},
@@ -37,7 +41,11 @@ export default {
type: String,
required: true,
},
- defaultProject: {
+ sourceProject: {
+ type: Object,
+ required: true,
+ },
+ targetProject: {
type: Object,
required: true,
},
@@ -50,14 +58,14 @@ export default {
return {
from: {
projects: this.projects,
- selectedProject: this.defaultProject,
+ selectedProject: this.targetProject,
revision: this.paramsFrom,
- refsProjectPath: this.refsProjectPath,
+ refsProjectPath: this.targetProjectRefsPath,
},
to: {
- selectedProject: this.defaultProject,
+ selectedProject: this.sourceProject,
revision: this.paramsTo,
- refsProjectPath: this.refsProjectPath,
+ refsProjectPath: this.sourceProjectRefsPath,
},
};
},
diff --git a/app/assets/javascripts/projects/compare/index.js b/app/assets/javascripts/projects/compare/index.js
index e485a086d39..074b8565c3c 100644
--- a/app/assets/javascripts/projects/compare/index.js
+++ b/app/assets/javascripts/projects/compare/index.js
@@ -5,13 +5,15 @@ export default function init() {
const el = document.getElementById('js-compare-selector');
const {
- refsProjectPath,
+ sourceProjectRefsPath,
+ targetProjectRefsPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
- projectTo,
+ sourceProject,
+ targetProject,
projectsFrom,
} = el.dataset;
@@ -23,13 +25,15 @@ export default function init() {
render(createElement) {
return createElement(CompareApp, {
props: {
- refsProjectPath,
+ sourceProjectRefsPath,
+ targetProjectRefsPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
- defaultProject: JSON.parse(projectTo),
+ sourceProject: JSON.parse(sourceProject),
+ targetProject: JSON.parse(targetProject),
projects: JSON.parse(projectsFrom),
},
});
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util.js b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util.js
index 0faf63db8a6..dbe6812cf16 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util.js
@@ -7,7 +7,7 @@ export const createLink = (href, innerText) => {
const link = document.createElement('a');
setAttributes(link, { href: escape(href), rel });
- link.innerText = escape(innerText);
+ link.textContent = innerText;
return link.outerHTML;
};
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/package_json_linker.js b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/package_json_linker.js
index d013d077ba3..3c6fc23c138 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/package_json_linker.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/package_json_linker.js
@@ -1,3 +1,4 @@
+import { unescape } from 'lodash';
import { joinPaths } from '~/lib/utils/url_utility';
import { NPM_URL } from '../../constants';
import { createLink, generateHLJSOpenTag } from './dependency_linker_util';
@@ -17,13 +18,15 @@ const DEPENDENCY_REGEX = new RegExp(
);
const handleReplace = (original, packageName, version, dependenciesToLink) => {
- const href = joinPaths(NPM_URL, packageName);
- const packageLink = createLink(href, packageName);
- const versionLink = createLink(href, version);
+ const unescapedPackageName = unescape(packageName);
+ const unescapedVersion = unescape(version);
+ const href = joinPaths(NPM_URL, unescapedPackageName);
+ const packageLink = createLink(href, unescapedPackageName);
+ const versionLink = createLink(href, unescapedVersion);
const closeAndOpenTag = `${closeTag}: ${attrOpenTag}`;
- const dependencyToLink = dependenciesToLink[packageName];
+ const dependencyToLink = dependenciesToLink[unescapedPackageName];
- if (dependencyToLink && dependencyToLink === version) {
+ if (dependencyToLink && dependencyToLink === unescapedVersion) {
return `${attrOpenTag}${packageLink}${closeAndOpenTag}${versionLink}${closeTag}`;
}
diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb
index 0fb77e2aaf4..b6ba1b13cc3 100644
--- a/app/controllers/concerns/creates_commit.rb
+++ b/app/controllers/concerns/creates_commit.rb
@@ -98,8 +98,7 @@ module CreatesCommit
project_new_merge_request_path(
@project_to_commit_into,
merge_request: {
- source_project_id: @project_to_commit_into.id,
- target_project_id: target_project.id,
+ target_project_id: @project_to_commit_into.default_merge_request_target.id,
source_branch: @branch_name,
target_branch: @start_branch
}
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb
index 09a06aaed8c..d7fd65f02a8 100644
--- a/app/controllers/projects/compare_controller.rb
+++ b/app/controllers/projects/compare_controller.rb
@@ -88,7 +88,7 @@ class Projects::CompareController < Projects::ApplicationController
# target == start_ref == from
def target_project
strong_memoize(:target_project) do
- next source_project unless compare_params.key?(:from_project_id)
+ next source_project.default_merge_request_target unless compare_params.key?(:from_project_id)
next source_project if compare_params[:from_project_id].to_i == source_project.id
target_project = target_projects(source_project).find_by_id(compare_params[:from_project_id])
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 7a7e63f5fc4..908da71a8e4 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -150,6 +150,7 @@ class SearchController < ApplicationController
payload[:metadata]['meta.search.filters.state'] = params[:state]
payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results]
payload[:metadata]['meta.search.project_ids'] = params[:project_ids]
+ payload[:metadata]['meta.search.language'] = params[:language]
payload[:metadata]['meta.search.type'] = @search_type if @search_type.present?
payload[:metadata]['meta.search.level'] = @search_level if @search_level.present?
payload[:metadata][:global_search_duration_s] = @global_search_duration_s if @global_search_duration_s.present?
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb
index f9d62747308..e955ad4cfda 100644
--- a/app/helpers/compare_helper.rb
+++ b/app/helpers/compare_helper.rb
@@ -1,25 +1,30 @@
# frozen_string_literal: true
module CompareHelper
- def create_mr_button?(from: params[:from], to: params[:to], source_project: @project, target_project: @target_project)
+ def create_mr_button?(source_project:, from:, to: nil, target_project: nil)
+ target_project ||= source_project.default_merge_request_target
+ to ||= target_project.default_branch
+
from.present? &&
to.present? &&
from != to &&
can?(current_user, :create_merge_request_from, source_project) &&
can?(current_user, :create_merge_request_in, target_project) &&
- target_project.repository.branch_exists?(from) &&
- source_project.repository.branch_exists?(to)
+ target_project.repository.branch_exists?(to) &&
+ source_project.repository.branch_exists?(from)
end
- def create_mr_path(from: params[:from], to: params[:to], source_project: @project, target_project: @target_project)
+ def create_mr_path(from:, source_project:, to: nil, target_project: nil, mr_params: {})
+ merge_request_params = {
+ source_branch: from
+ }
+
+ merge_request_params[:target_project_id] = target_project.id if target_project
+ merge_request_params[:target_branch] = to if to
+
project_new_merge_request_path(
- target_project,
- merge_request: {
- source_project_id: source_project.id,
- source_branch: to,
- target_project_id: target_project.id,
- target_branch: from
- }
+ source_project,
+ merge_request: merge_request_params.merge(mr_params)
)
end
@@ -32,14 +37,32 @@ module CompareHelper
def project_compare_selector_data(project, merge_request, params)
{
project_compare_index_path: project_compare_index_path(project),
- refs_project_path: refs_project_path(project),
+ source_project: { id: project.id, name: project.full_path }.to_json,
+ target_project: { id: @target_project.id, name: @target_project.full_path }.to_json,
+ source_project_refs_path: refs_project_path(project),
+ target_project_refs_path: refs_project_path(@target_project),
params_from: params[:from],
- params_to: params[:to],
- project_merge_request_path: merge_request.present? ? project_merge_request_path(project, merge_request) : '',
- create_mr_path: create_mr_button? ? create_mr_path : ''
+ params_to: params[:to]
}.tap do |data|
- data[:project_to] = { id: project.id, name: project.full_path }.to_json
- data[:projects_from] = target_projects(project).map { |project| { id: project.id, name: project.full_path } }.to_json
+ data[:projects_from] = target_projects(project).map do |target_project|
+ { id: target_project.id, name: target_project.full_path }
+ end.to_json
+
+ data[:project_merge_request_path] =
+ if merge_request.present?
+ project_merge_request_path(project, merge_request)
+ else
+ ''
+ end
+
+ # The `from` and `to` params are inverted in the compare page. The route is `/compare/:from...:to`, but the UI
+ # correctly shows `:to` as the "Source" (i.e. the `from` for MR), and `:from` as "Target" (i.e. the `to` for MR).
+ data[:create_mr_path] =
+ if create_mr_button?(from: params[:to], to: params[:from], source_project: project, target_project: @target_project)
+ create_mr_path(from: params[:to], to: params[:from], source_project: project, target_project: @target_project)
+ else
+ ''
+ end
end
end
end
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb
index d840223a066..56574062a11 100644
--- a/app/helpers/merge_requests_helper.rb
+++ b/app/helpers/merge_requests_helper.rb
@@ -3,23 +3,12 @@
module MergeRequestsHelper
include Gitlab::Utils::StrongMemoize
- def new_mr_path_from_push_event(event)
- target_project = event.project.default_merge_request_target
- project_new_merge_request_path(
- event.project,
- new_mr_from_push_event(event, target_project)
- )
+ def create_mr_button_from_event?(event)
+ create_mr_button?(from: event.branch_name, source_project: event.project)
end
- def new_mr_from_push_event(event, target_project)
- {
- merge_request: {
- source_project_id: event.project.id,
- target_project_id: target_project.id,
- source_branch: event.branch_name,
- target_branch: target_project.repository.root_ref
- }
- }
+ def create_mr_path_from_push_event(event)
+ create_mr_path(from: event.branch_name, source_project: event.project)
end
def mr_css_classes(mr)
diff --git a/app/models/concerns/enums/sbom.rb b/app/models/concerns/enums/sbom.rb
new file mode 100644
index 00000000000..518efa669ad
--- /dev/null
+++ b/app/models/concerns/enums/sbom.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module Enums
+ class Sbom
+ COMPONENT_TYPES = {
+ library: 0
+ }.with_indifferent_access.freeze
+
+ def self.component_types
+ COMPONENT_TYPES
+ end
+ end
+end
diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml
index 62d6ab36578..4a6b7fcfa84 100644
--- a/app/views/events/event/_push.html.haml
+++ b/app/views/events/event/_push.html.haml
@@ -21,8 +21,7 @@
%ul.content-list.event-commits
= render "events/commit", project: project, event: event
- - create_mr = event.new_ref? && create_mr_button?(from: project.default_branch, to: event.ref_name, source_project: project, target_project: project) && event.authored_by?(current_user)
- - create_mr_path = create_mr_path(from: project.default_branch, to: event.ref_name, source_project: project, target_project: project) if create_mr
+ - create_mr = event.new_ref? && create_mr_button_from_event?(event) && event.authored_by?(current_user)
- if event.commits_count > 1
%li.commits-stat
%span ... and #{pluralize(event.commits_count - 1, 'more commit')}.
@@ -41,9 +40,9 @@
- if create_mr
%span
or
- = link_to create_mr_path do
+ = link_to create_mr_path_from_push_event(event) do
create a merge request
- elsif create_mr
%li.commits-stat
- = link_to create_mr_path do
+ = link_to create_mr_path_from_push_event(event) do
Create merge request
diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml
index 9845de17a11..859f065377d 100644
--- a/app/views/projects/_last_push.html.haml
+++ b/app/views/projects/_last_push.html.haml
@@ -14,7 +14,7 @@
#{time_ago_with_tooltip(event.created_at)}
- - if can?(current_user, :create_merge_request_in, event.project.default_merge_request_target)
+ - if create_mr_button_from_event?(event)
= c.actions do
- = link_to new_mr_path_from_push_event(event), title: _("New merge request"), class: "btn gl-button btn-confirm qa-create-merge-request" do
- #{ _('Create merge request') }
+ = render Pajamas::ButtonComponent.new(variant: :confirm, href: create_mr_path_from_push_event(event), button_options: { class: 'qa-create-merge-request' }) do
+ = _('Create merge request')
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 1477ae66d80..52b8d6bc66f 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -33,8 +33,8 @@
.gl-display-inline-flex.gl-vertical-align-middle.gl-mr-5
%svg.s24
- - if merge_project && create_mr_button?(from: @repository.root_ref, to: branch.name, source_project: @project, target_project: @project)
- = link_to create_mr_path(from: @repository.root_ref, to: branch.name, source_project: @project, target_project: @project), class: 'gl-button btn btn-default' do
+ - if merge_project && create_mr_button?(from: branch.name, source_project: @project)
+ = render Pajamas::ButtonComponent.new(href: create_mr_path(from: branch.name, source_project: @project)) do
= _('Merge request')
- if branch.name != @repository.root_ref
diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml
index e5be3a897a5..4007b657403 100644
--- a/app/views/projects/commits/show.html.haml
+++ b/app/views/projects/commits/show.html.haml
@@ -18,9 +18,10 @@
- if @merge_request.present?
.control.d-none.d-md-block
= link_to _("View open merge request"), project_merge_request_path(@project, @merge_request), class: 'btn gl-button'
- - elsif create_mr_button?(from: @repository.root_ref, to: @ref, source_project: @project, target_project: @project)
+ - elsif create_mr_button?(from: @ref, source_project: @project)
.control.d-none.d-md-block
- = link_to _("Create merge request"), create_mr_path(from: @repository.root_ref, to: @ref, source_project: @project, target_project: @project), class: 'btn gl-button btn-confirm'
+ = render Pajamas::ButtonComponent.new(variant: :confirm, href: create_mr_path(from: @ref, source_project: @project)) do
+ = _("Create merge request")
.control
= form_tag(project_commits_path(@project, @id), method: :get, class: 'commits-search-form js-signature-container', data: { 'signatures-path' => namespace_project_signatures_path }) do
diff --git a/app/views/projects/issues/_new_branch.html.haml b/app/views/projects/issues/_new_branch.html.haml
index 801841edc26..f9798d25b06 100644
--- a/app/views/projects/issues/_new_branch.html.haml
+++ b/app/views/projects/issues/_new_branch.html.haml
@@ -6,11 +6,10 @@
- create_mr_text = can_create_confidential_merge_request? ? _('Create confidential merge request') : _('Create merge request')
- can_create_path = can_create_branch_project_issue_path(@project, @issue)
- - create_mr_path = project_new_merge_request_path(@project, merge_request: { source_branch: @issue.to_branch_name, target_branch: @project.default_branch, issue_iid: @issue.iid })
- create_branch_path = project_branches_path(@project, branch_name: @issue.to_branch_name, ref: @project.default_branch, issue_iid: @issue.iid, format: :json)
- refs_path = refs_namespace_project_path(@project.namespace, @project, search: '')
- .create-mr-dropdown-wrap.d-inline-block.full-width-mobile.js-create-mr{ data: { project_path: @project.full_path, project_id: @project.id, can_create_path: can_create_path, create_mr_path: create_mr_path, create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } }
+ .create-mr-dropdown-wrap.d-inline-block.full-width-mobile.js-create-mr{ data: { project_path: @project.full_path, project_id: @project.id, can_create_path: can_create_path, create_mr_path: create_mr_path(from: @issue.to_branch_name, source_project: @project, to: @project.default_branch, mr_params: { issue_iid: @issue.iid }), create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } }
.btn-group.unavailable
%button.gl-button.btn{ type: 'button', disabled: 'disabled' }
= gl_loading_icon(inline: true, css_class: 'js-create-mr-spinner gl-button-icon gl-display-none')
diff --git a/config/initializers/database_query_analyzers.rb b/config/initializers/database_query_analyzers.rb
index d1010e054af..b7f1c63db78 100644
--- a/config/initializers/database_query_analyzers.rb
+++ b/config/initializers/database_query_analyzers.rb
@@ -5,7 +5,13 @@ Gitlab::Database::QueryAnalyzer.instance.hook!
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics)
if Rails.env.test? || Gitlab::Utils.to_boolean(ENV['ENABLE_CROSS_DATABASE_MODIFICATION_DETECTION'], default: false)
- Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification)
+ query_analyzer = ::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification
+ Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(query_analyzer)
+end
+
+if Gitlab.dev_or_test_env?
+ query_analyzer = ::Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection
+ Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(query_analyzer)
end
Gitlab::Application.configure do |config|
diff --git a/db/post_migrate/20220720121421_remove_pat_and_ssh_enforcement_columns_from_application_settings.rb b/db/post_migrate/20220720121421_remove_pat_and_ssh_enforcement_columns_from_application_settings.rb
new file mode 100644
index 00000000000..b03cad08f35
--- /dev/null
+++ b/db/post_migrate/20220720121421_remove_pat_and_ssh_enforcement_columns_from_application_settings.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class RemovePatAndSshEnforcementColumnsFromApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ remove_column :application_settings, :enforce_pat_expiration, :boolean, default: true, null: false
+ remove_column :application_settings, :enforce_ssh_key_expiration, :boolean, default: true, null: false
+ end
+end
diff --git a/db/schema_migrations/20220720121421 b/db/schema_migrations/20220720121421
new file mode 100644
index 00000000000..da6450068ee
--- /dev/null
+++ b/db/schema_migrations/20220720121421
@@ -0,0 +1 @@
+3ccb1e6d2ab41d4d84e0582563c68b0518d57f518d1560b1bacd257a40e14034 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index b0feeea8e00..363892f00da 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11186,7 +11186,6 @@ CREATE TABLE application_settings (
elasticsearch_pause_indexing boolean DEFAULT false NOT NULL,
repository_storages_weighted jsonb DEFAULT '{}'::jsonb NOT NULL,
max_import_size integer DEFAULT 0 NOT NULL,
- enforce_pat_expiration boolean DEFAULT true NOT NULL,
compliance_frameworks smallint[] DEFAULT '{}'::smallint[] NOT NULL,
notify_on_unknown_sign_in boolean DEFAULT true NOT NULL,
default_branch_name text,
@@ -11234,7 +11233,6 @@ CREATE TABLE application_settings (
rate_limiting_response_text text,
invisible_captcha_enabled boolean DEFAULT false NOT NULL,
container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 NOT NULL,
- enforce_ssh_key_expiration boolean DEFAULT true NOT NULL,
git_two_factor_session_expiry integer DEFAULT 15 NOT NULL,
keep_latest_artifact boolean DEFAULT true NOT NULL,
notes_create_limit integer DEFAULT 300 NOT NULL,
diff --git a/doc/development/database/multiple_databases.md b/doc/development/database/multiple_databases.md
index 9641ea37002..5c10d1b66d9 100644
--- a/doc/development/database/multiple_databases.md
+++ b/doc/development/database/multiple_databases.md
@@ -1,6 +1,6 @@
---
stage: Data Stores
-group: Sharding
+group: Pods
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
diff --git a/doc/development/fips_compliance.md b/doc/development/fips_compliance.md
index 311b1a855a8..9a4e30a8d9c 100644
--- a/doc/development/fips_compliance.md
+++ b/doc/development/fips_compliance.md
@@ -298,6 +298,9 @@ gitlab:
gitlab-mailroom:
image:
tag: master-fips
+ gitlab-pages:
+ image:
+ tag: master-fips
migrations:
image:
tag: master-fips
@@ -327,7 +330,7 @@ See [this issue](https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3153#note_
how to build NGINX and the Ingress Controller.
You can also use release tags, but the versioning is tricky because each
-component may use its own versioning scheme. For example, for GitLab v15.1:
+component may use its own versioning scheme. For example, for GitLab v15.2:
```yaml
global:
@@ -351,6 +354,9 @@ gitlab:
gitlab-mailroom:
image:
tag: v15.2.0-fips
+ gitlab-pages:
+ image:
+ tag: v1.61.0-fips
migrations:
image:
tag: v15.2.0-fips
diff --git a/lib/gitlab/ci/parsers/sbom/cyclonedx.rb b/lib/gitlab/ci/parsers/sbom/cyclonedx.rb
new file mode 100644
index 00000000000..70c9e81aa3a
--- /dev/null
+++ b/lib/gitlab/ci/parsers/sbom/cyclonedx.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Parsers
+ module Sbom
+ class Cyclonedx
+ SUPPORTED_SPEC_VERSIONS = %w[1.4].freeze
+ COMPONENT_ATTRIBUTES = %w[type name version].freeze
+
+ def initialize(json_data, report)
+ @json_data = json_data
+ @report = report
+ end
+
+ def parse!
+ @data = Gitlab::Json.parse(json_data)
+
+ return unless supported_spec_version?
+
+ parse_components
+ rescue JSON::ParserError => e
+ report.add_error("Report JSON is invalid: #{e}")
+ end
+
+ private
+
+ attr_reader :json_data, :report, :data
+
+ def supported_spec_version?
+ return true if SUPPORTED_SPEC_VERSIONS.include?(data['specVersion'])
+
+ report.add_error(
+ "Unsupported CycloneDX spec version. Must be one of: %{versions}" \
+ % { versions: SUPPORTED_SPEC_VERSIONS.join(', ') }
+ )
+
+ false
+ end
+
+ def parse_components
+ data['components']&.each do |component|
+ next unless supported_component_type?(component['type'])
+
+ report.add_component(component.slice(*COMPONENT_ATTRIBUTES))
+ end
+ end
+
+ def supported_component_type?(type)
+ ::Enums::Sbom.component_types.include?(type.to_sym)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/reports/sbom/component.rb b/lib/gitlab/ci/reports/sbom/component.rb
new file mode 100644
index 00000000000..86b9be274cc
--- /dev/null
+++ b/lib/gitlab/ci/reports/sbom/component.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Reports
+ module Sbom
+ class Component
+ attr_reader :component_type, :name, :version
+
+ def initialize(component = {})
+ @component_type = component['type']
+ @name = component['name']
+ @version = component['version']
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/reports/sbom/report.rb b/lib/gitlab/ci/reports/sbom/report.rb
new file mode 100644
index 00000000000..a7edcd20877
--- /dev/null
+++ b/lib/gitlab/ci/reports/sbom/report.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Reports
+ module Sbom
+ class Report
+ attr_reader :components, :sources, :errors
+
+ def initialize
+ @components = []
+ @errors = []
+ @sources = []
+ end
+
+ def add_error(error)
+ errors << error
+ end
+
+ def add_source(source)
+ sources << Source.new(source)
+ end
+
+ def add_component(component)
+ components << Component.new(component)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/reports/sbom/source.rb b/lib/gitlab/ci/reports/sbom/source.rb
new file mode 100644
index 00000000000..60bf30b65a5
--- /dev/null
+++ b/lib/gitlab/ci/reports/sbom/source.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Reports
+ module Sbom
+ class Source
+ attr_reader :source_type, :data, :fingerprint
+
+ def initialize(source = {})
+ @source_type = source['type']
+ @data = source['data']
+ @fingerprint = source['fingerprint']
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake
index 40d88ea8a5b..73d01fb5dfe 100644
--- a/lib/tasks/gitlab/tw/codeowners.rake
+++ b/lib/tasks/gitlab/tw/codeowners.rake
@@ -69,7 +69,7 @@ namespace :tw do
CodeOwnerRule.new('Release', '@rdickenson'),
CodeOwnerRule.new('Respond', '@msedlakjakubowski'),
CodeOwnerRule.new('Runner', '@sselhorn'),
- CodeOwnerRule.new('Sharding', '@sselhorn'),
+ CodeOwnerRule.new('Pods', '@sselhorn'),
CodeOwnerRule.new('Source Code', '@aqualls'),
CodeOwnerRule.new('Static Analysis', '@rdickenson'),
CodeOwnerRule.new('Style Guide', '@sselhorn'),
diff --git a/package.json b/package.json
index 53138f236c4..620884aaa41 100644
--- a/package.json
+++ b/package.json
@@ -102,7 +102,7 @@
"codesandbox-api": "0.0.23",
"compression-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^6.4.1",
- "core-js": "^3.23.5",
+ "core-js": "^3.24.0",
"cron-validator": "^1.1.1",
"cronstrue": "^1.122.0",
"cropper": "^2.3.0",
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb
index cc807098498..887a5ba598f 100644
--- a/spec/controllers/projects/blob_controller_spec.rb
+++ b/spec/controllers/projects/blob_controller_spec.rb
@@ -352,7 +352,6 @@ RSpec.describe Projects::BlobController do
project_new_merge_request_path(
forked_project,
merge_request: {
- source_project_id: forked_project.id,
target_project_id: project.id,
source_branch: "fork-test-1",
target_branch: "master"
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index a72c98552a5..59b2168c41a 100644
--- a/spec/controllers/projects/commit_controller_spec.rb
+++ b/spec/controllers/projects/commit_controller_spec.rb
@@ -378,7 +378,6 @@ RSpec.describe Projects::CommitController do
project_new_merge_request_path(
source_project,
merge_request: {
- source_project_id: source_project.id,
target_project_id: project.id,
source_branch: branch,
target_branch: 'feature'
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index b4d4e01e972..6922b0f3831 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -410,9 +410,20 @@ RSpec.describe SearchController do
expect(payload[:metadata]['meta.search.project_ids']).to eq(%w(456 789))
expect(payload[:metadata]['meta.search.type']).to eq('basic')
expect(payload[:metadata]['meta.search.level']).to eq('global')
+ expect(payload[:metadata]['meta.search.language']).to eq('ruby')
end
- get :show, params: { scope: 'issues', search: 'hello world', group_id: '123', project_id: '456', project_ids: %w(456 789), confidential: true, state: true, force_search_results: true }
+ get :show, params: {
+ scope: 'issues',
+ search: 'hello world',
+ group_id: '123',
+ project_id: '456',
+ project_ids: %w(456 789),
+ confidential: true,
+ state: true,
+ force_search_results: true,
+ language: 'ruby'
+ }
end
it 'appends the default scope in meta.search.scope' do
diff --git a/spec/features/projects/merge_request_button_spec.rb b/spec/features/projects/merge_request_button_spec.rb
index 335ae6794b7..eb52a7821f9 100644
--- a/spec/features/projects/merge_request_button_spec.rb
+++ b/spec/features/projects/merge_request_button_spec.rb
@@ -11,6 +11,8 @@ RSpec.describe 'Merge Request button' do
let(:forked_project) { fork_project(project, user, repository: true) }
shared_examples 'Merge request button only shown when allowed' do
+ let(:extra_mr_params) { {} }
+
context 'not logged in' do
it 'does not show Create merge request button' do
visit url
@@ -31,11 +33,8 @@ RSpec.describe 'Merge Request button' do
href = project_new_merge_request_path(
project,
merge_request: {
- source_project_id: project.id,
- source_branch: 'feature',
- target_project_id: project.id,
- target_branch: 'master'
- }
+ source_branch: 'feature'
+ }.merge(extra_mr_params)
)
visit url
@@ -90,11 +89,8 @@ RSpec.describe 'Merge Request button' do
href = project_new_merge_request_path(
forked_project,
merge_request: {
- source_project_id: forked_project.id,
- source_branch: 'feature',
- target_project_id: forked_project.id,
- target_branch: 'master'
- }
+ source_branch: 'feature'
+ }.merge(extra_mr_params)
)
visit fork_url
@@ -121,6 +117,7 @@ RSpec.describe 'Merge Request button' do
it_behaves_like 'Merge request button only shown when allowed' do
let(:url) { project_compare_path(project, from: 'master', to: 'feature') }
let(:fork_url) { project_compare_path(forked_project, from: 'master', to: 'feature') }
+ let(:extra_mr_params) { { target_project_id: project.id, target_branch: 'master' } }
end
it 'shows the correct merge request button when viewing across forks', :js do
@@ -128,9 +125,8 @@ RSpec.describe 'Merge Request button' do
project.add_developer(user)
href = project_new_merge_request_path(
- project,
+ forked_project,
merge_request: {
- source_project_id: forked_project.id,
source_branch: 'feature',
target_project_id: project.id,
target_branch: 'master'
diff --git a/spec/frontend/projects/compare/components/app_spec.js b/spec/frontend/projects/compare/components/app_spec.js
index 18e7f2e0f6e..c9ffdf20c32 100644
--- a/spec/frontend/projects/compare/components/app_spec.js
+++ b/spec/frontend/projects/compare/components/app_spec.js
@@ -34,7 +34,8 @@ describe('CompareApp component', () => {
expect(wrapper.props()).toEqual(
expect.objectContaining({
projectCompareIndexPath: defaultProps.projectCompareIndexPath,
- refsProjectPath: defaultProps.refsProjectPath,
+ sourceProjectRefsPath: defaultProps.sourceProjectRefsPath,
+ targetProjectRefsPath: defaultProps.targetProjectRefsPath,
paramsFrom: defaultProps.paramsFrom,
paramsTo: defaultProps.paramsTo,
}),
diff --git a/spec/frontend/projects/compare/components/mock_data.js b/spec/frontend/projects/compare/components/mock_data.js
index 61309928c26..81d64469a2a 100644
--- a/spec/frontend/projects/compare/components/mock_data.js
+++ b/spec/frontend/projects/compare/components/mock_data.js
@@ -1,7 +1,12 @@
-const refsProjectPath = 'some/refs/path';
+const sourceProjectRefsPath = 'some/refs/path';
+const targetProjectRefsPath = 'some/refs/path';
const paramsName = 'to';
const paramsBranch = 'main';
-const defaultProject = {
+const sourceProject = {
+ name: 'some-to-name',
+ id: '2',
+};
+const targetProject = {
name: 'some-to-name',
id: '1',
};
@@ -9,29 +14,31 @@ const defaultProject = {
export const appDefaultProps = {
projectCompareIndexPath: 'some/path',
projectMergeRequestPath: '',
- projects: [defaultProject],
+ projects: [sourceProject],
paramsFrom: 'main',
paramsTo: 'target/branch',
createMrPath: '',
- refsProjectPath,
- defaultProject,
+ sourceProjectRefsPath,
+ targetProjectRefsPath,
+ sourceProject,
+ targetProject,
};
export const revisionCardDefaultProps = {
- selectedProject: defaultProject,
+ selectedProject: targetProject,
paramsBranch,
revisionText: 'Source',
- refsProjectPath,
+ refsProjectPath: sourceProjectRefsPath,
paramsName,
};
export const repoDropdownDefaultProps = {
- selectedProject: defaultProject,
+ selectedProject: targetProject,
paramsName,
};
export const revisionDropdownDefaultProps = {
- refsProjectPath,
+ refsProjectPath: sourceProjectRefsPath,
paramsBranch,
paramsName,
};
diff --git a/spec/frontend/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util_spec.js b/spec/frontend/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util_spec.js
index ee200747af9..8079d5ad99a 100644
--- a/spec/frontend/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util_spec.js
+++ b/spec/frontend/vue_shared/components/source_viewer/plugins/utils/dependency_linker_util_spec.js
@@ -14,10 +14,11 @@ describe('createLink', () => {
it('escapes the user-controlled content', () => {
const unescapedXSS = '<script>XSS</script>';
- const escapedXSS = '&amp;lt;script&amp;gt;XSS&amp;lt;/script&amp;gt;';
+ const escapedPackageName = '&lt;script&gt;XSS&lt;/script&gt;';
+ const escapedHref = '&amp;lt;script&amp;gt;XSS&amp;lt;/script&amp;gt;';
const href = `http://test.com/${unescapedXSS}`;
const innerText = `testing${unescapedXSS}`;
- const result = `<a href="http://test.com/${escapedXSS}" rel="nofollow noreferrer noopener">testing${escapedXSS}</a>`;
+ const result = `<a href="http://test.com/${escapedHref}" rel="nofollow noreferrer noopener">testing${escapedPackageName}</a>`;
expect(createLink(href, innerText)).toBe(result);
});
diff --git a/spec/lib/gitlab/background_migration/backfill_ci_namespace_mirrors_spec.rb b/spec/lib/gitlab/background_migration/backfill_ci_namespace_mirrors_spec.rb
index 8980a26932b..7d128644300 100644
--- a/spec/lib/gitlab/background_migration/backfill_ci_namespace_mirrors_spec.rb
+++ b/spec/lib/gitlab/background_migration/backfill_ci_namespace_mirrors_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::BackfillCiNamespaceMirrors, :migration, schema: 20211208122200 do
+RSpec.describe Gitlab::BackgroundMigration::BackfillCiNamespaceMirrors, :migration,
+ :suppress_gitlab_schemas_validate_connection, schema: 20211208122200 do
let(:namespaces) { table(:namespaces) }
let(:ci_namespace_mirrors) { table(:ci_namespace_mirrors) }
diff --git a/spec/lib/gitlab/background_migration/backfill_ci_project_mirrors_spec.rb b/spec/lib/gitlab/background_migration/backfill_ci_project_mirrors_spec.rb
index 4eec83879e3..16470409339 100644
--- a/spec/lib/gitlab/background_migration/backfill_ci_project_mirrors_spec.rb
+++ b/spec/lib/gitlab/background_migration/backfill_ci_project_mirrors_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::BackfillCiProjectMirrors, :migration, schema: 20211208122201 do
+RSpec.describe Gitlab::BackgroundMigration::BackfillCiProjectMirrors, :migration,
+ :suppress_gitlab_schemas_validate_connection, schema: 20211208122201 do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:ci_project_mirrors) { table(:ci_project_mirrors) }
diff --git a/spec/lib/gitlab/background_migration/backfill_ci_queuing_tables_spec.rb b/spec/lib/gitlab/background_migration/backfill_ci_queuing_tables_spec.rb
index 1aac5970a77..aaf8c124a83 100644
--- a/spec/lib/gitlab/background_migration/backfill_ci_queuing_tables_spec.rb
+++ b/spec/lib/gitlab/background_migration/backfill_ci_queuing_tables_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::BackfillCiQueuingTables, :migration, schema: 20220208115439 do
+RSpec.describe Gitlab::BackgroundMigration::BackfillCiQueuingTables, :migration,
+ :suppress_gitlab_schemas_validate_connection, schema: 20220208115439 do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:ci_cd_settings) { table(:project_ci_cd_settings) }
diff --git a/spec/lib/gitlab/background_migration/backfill_projects_with_coverage_spec.rb b/spec/lib/gitlab/background_migration/backfill_projects_with_coverage_spec.rb
index 49056154744..4a65ecf8c75 100644
--- a/spec/lib/gitlab/background_migration/backfill_projects_with_coverage_spec.rb
+++ b/spec/lib/gitlab/background_migration/backfill_projects_with_coverage_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::BackfillProjectsWithCoverage, schema: 20210818185845 do
+RSpec.describe Gitlab::BackgroundMigration::BackfillProjectsWithCoverage,
+ :suppress_gitlab_schemas_validate_connection, schema: 20210818185845 do
let(:projects) { table(:projects) }
let(:project_ci_feature_usages) { table(:project_ci_feature_usages) }
let(:ci_pipelines) { table(:ci_pipelines) }
diff --git a/spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb b/spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb
index db822f36c21..2b082ca7379 100644
--- a/spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb
+++ b/spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::CopyCiBuildsColumnsToSecurityScans, schema: 20210728174349 do
+RSpec.describe Gitlab::BackgroundMigration::CopyCiBuildsColumnsToSecurityScans,
+ :suppress_gitlab_schemas_validate_connection, schema: 20210728174349 do
let(:migration) { described_class.new }
let_it_be(:namespaces) { table(:namespaces) }
diff --git a/spec/lib/gitlab/background_migration/drop_invalid_security_findings_spec.rb b/spec/lib/gitlab/background_migration/drop_invalid_security_findings_spec.rb
index 7cc64889fc8..5fdd8683d06 100644
--- a/spec/lib/gitlab/background_migration/drop_invalid_security_findings_spec.rb
+++ b/spec/lib/gitlab/background_migration/drop_invalid_security_findings_spec.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::DropInvalidSecurityFindings, schema: 20211108211434 do
+RSpec.describe Gitlab::BackgroundMigration::DropInvalidSecurityFindings, :suppress_gitlab_schemas_validate_connection,
+ schema: 20211108211434 do
let(:namespace) { table(:namespaces).create!(name: 'user', path: 'user', type: Namespaces::UserNamespace.sti_name) }
let(:project) { table(:projects).create!(namespace_id: namespace.id) }
diff --git a/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb b/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb
index 65d55f85a98..51a09d50a19 100644
--- a/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb
+++ b/spec/lib/gitlab/background_migration/extract_project_topics_into_separate_table_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::ExtractProjectTopicsIntoSeparateTable, schema: 20210730104800 do
+RSpec.describe Gitlab::BackgroundMigration::ExtractProjectTopicsIntoSeparateTable,
+ :suppress_gitlab_schemas_validate_connection, schema: 20210730104800 do
it 'correctly extracts project topics into separate table' do
namespaces = table(:namespaces)
projects = table(:projects)
diff --git a/spec/lib/gitlab/background_migration/migrate_project_taggings_context_from_tags_to_topics_spec.rb b/spec/lib/gitlab/background_migration/migrate_project_taggings_context_from_tags_to_topics_spec.rb
index 5e2f32c54be..5495d786a48 100644
--- a/spec/lib/gitlab/background_migration/migrate_project_taggings_context_from_tags_to_topics_spec.rb
+++ b/spec/lib/gitlab/background_migration/migrate_project_taggings_context_from_tags_to_topics_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::MigrateProjectTaggingsContextFromTagsToTopics, schema: 20210511095658 do
+RSpec.describe Gitlab::BackgroundMigration::MigrateProjectTaggingsContextFromTagsToTopics,
+ :suppress_gitlab_schemas_validate_connection, schema: 20210511095658 do
it 'correctly migrates project taggings context from tags to topics' do
taggings = table(:taggings)
diff --git a/spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb b/spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb
index 11e7c70250e..2f0eef3c399 100644
--- a/spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb
+++ b/spec/lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::NullifyOrphanRunnerIdOnCiBuilds, migration: :gitlab_ci, schema: 20220223112304 do
+RSpec.describe Gitlab::BackgroundMigration::NullifyOrphanRunnerIdOnCiBuilds,
+ :suppress_gitlab_schemas_validate_connection, migration: :gitlab_ci, schema: 20220223112304 do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:ci_runners) { table(:ci_runners) }
@@ -20,7 +21,9 @@ RSpec.describe Gitlab::BackgroundMigration::NullifyOrphanRunnerIdOnCiBuilds, mig
end
after do
- helpers.add_concurrent_foreign_key(:ci_builds, :ci_runners, column: :runner_id, on_delete: :nullify, validate: false)
+ helpers.add_concurrent_foreign_key(
+ :ci_builds, :ci_runners, column: :runner_id, on_delete: :nullify, validate: false
+ )
end
describe '#perform' do
diff --git a/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb b/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb
index 8d71b117107..a609227be05 100644
--- a/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb
+++ b/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb
@@ -20,7 +20,7 @@ def create_background_migration_job(ids, status)
)
end
-RSpec.describe Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid, schema: 20211124132705 do
+RSpec.describe Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid, :suppress_gitlab_schemas_validate_connection, schema: 20211124132705 do
let(:background_migration_jobs) { table(:background_migration_jobs) }
let(:pending_jobs) { background_migration_jobs.where(status: Gitlab::Database::BackgroundMigrationJob.statuses['pending']) }
let(:succeeded_jobs) { background_migration_jobs.where(status: Gitlab::Database::BackgroundMigrationJob.statuses['succeeded']) }
diff --git a/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb b/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb
index 8cdcec9621c..eabc012f98b 100644
--- a/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb
+++ b/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::RemoveAllTraceExpirationDates, :migration, schema: 20220131000001 do
+RSpec.describe Gitlab::BackgroundMigration::RemoveAllTraceExpirationDates, :migration,
+ :suppress_gitlab_schemas_validate_connection, schema: 20220131000001 do
subject(:perform) { migration.perform(1, 99) }
let(:migration) { described_class.new }
diff --git a/spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb b/spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
index 07cff32304e..33ad74fbee8 100644
--- a/spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
+++ b/spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'spec_helper'
-RSpec.describe Gitlab::BackgroundMigration::RemoveOccurrencePipelinesAndDuplicateVulnerabilitiesFindings, :migration, schema: 20220326161803 do
+RSpec.describe Gitlab::BackgroundMigration::RemoveOccurrencePipelinesAndDuplicateVulnerabilitiesFindings, :migration,
+ :suppress_gitlab_schemas_validate_connection, schema: 20220326161803 do
let(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') }
let(:users) { table(:users) }
let(:user) { create_user! }
diff --git a/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb b/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb
new file mode 100644
index 00000000000..59a7a03acea
--- /dev/null
+++ b/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb
@@ -0,0 +1,90 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Parsers::Sbom::Cyclonedx do
+ let(:report) { instance_double('Gitlab::Ci::Reports::Sbom::Report') }
+ let(:raw_report_data) { report_data.to_json }
+
+ let(:base_report_data) do
+ {
+ 'bomFormat' => 'CycloneDX',
+ 'specVersion' => '1.4',
+ 'version' => 1
+ }
+ end
+
+ subject(:parse!) { described_class.new(raw_report_data, report).parse! }
+
+ context 'when report JSON is invalid' do
+ let(:raw_report_data) { '{ ' }
+
+ it 'handles errors and adds them to the report' do
+ expect(report).to receive(:add_error).with(a_string_including("Report JSON is invalid:"))
+
+ expect { parse! }.not_to raise_error
+ end
+ end
+
+ context 'when report uses an unsupported spec version' do
+ let(:report_data) { base_report_data.merge({ 'specVersion' => '1.3' }) }
+
+ it 'reports unsupported version as an error' do
+ expect(report).to receive(:add_error).with("Unsupported CycloneDX spec version. Must be one of: 1.4")
+
+ parse!
+ end
+ end
+
+ context 'when cyclonedx report has no components' do
+ let(:report_data) { base_report_data }
+
+ it 'skips component processing' do
+ expect(report).not_to receive(:add_component)
+
+ parse!
+ end
+ end
+
+ context 'when report has components' do
+ let(:report_data) { base_report_data.merge({ 'components' => components }) }
+ let(:components) do
+ [
+ {
+ "name" => "activesupport",
+ "version" => "5.1.4",
+ "purl" => "pkg:gem/activesupport@5.1.4",
+ "type" => "library",
+ "bom-ref" => "pkg:gem/activesupport@5.1.4"
+ },
+ {
+ "name" => "byebug",
+ "version" => "10.0.0",
+ "purl" => "pkg:gem/byebug@10.0.0",
+ "type" => "library",
+ "bom-ref" => "pkg:gem/byebug@10.0.0"
+ },
+ {
+ "name" => "minimal-component",
+ "type" => "library"
+ },
+ {
+ # Should be skipped
+ "name" => "unrecognized-type",
+ "type" => "unknown"
+ }
+ ]
+ end
+
+ it 'adds each component, ignoring unused attributes' do
+ expect(report).to receive(:add_component)
+ .with({ "name" => "activesupport", "version" => "5.1.4", "type" => "library" })
+ expect(report).to receive(:add_component)
+ .with({ "name" => "byebug", "version" => "10.0.0", "type" => "library" })
+ expect(report).to receive(:add_component)
+ .with({ "name" => "minimal-component", "type" => "library" })
+
+ parse!
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/reports/sbom/component_spec.rb b/spec/lib/gitlab/ci/reports/sbom/component_spec.rb
new file mode 100644
index 00000000000..672117c311f
--- /dev/null
+++ b/spec/lib/gitlab/ci/reports/sbom/component_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Reports::Sbom::Component do
+ let(:attributes) do
+ {
+ 'type' => 'library',
+ 'name' => 'component-name',
+ 'version' => 'v0.0.1'
+ }
+ end
+
+ subject { described_class.new(attributes) }
+
+ it 'has correct attributes' do
+ expect(subject).to have_attributes(
+ component_type: 'library',
+ name: 'component-name',
+ version: 'v0.0.1'
+ )
+ end
+end
diff --git a/spec/lib/gitlab/ci/reports/sbom/report_spec.rb b/spec/lib/gitlab/ci/reports/sbom/report_spec.rb
new file mode 100644
index 00000000000..fe1025d16bf
--- /dev/null
+++ b/spec/lib/gitlab/ci/reports/sbom/report_spec.rb
@@ -0,0 +1,65 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Reports::Sbom::Report do
+ subject(:report) { described_class.new }
+
+ describe '#add_error' do
+ it 'appends errors to a list' do
+ report.add_error('error1')
+ report.add_error('error2')
+
+ expect(report.errors).to match_array(%w[error1 error2])
+ end
+ end
+
+ describe '#add_source' do
+ let_it_be(:sources) do
+ [
+ {
+ 'type' => :dependency_file,
+ 'data' => {
+ 'input_file' => { 'name' => 'package-lock.json' },
+ 'package_manager' => { 'name' => 'npm' },
+ 'language' => { 'name' => 'JavaScript' }
+ },
+ 'fingerprint' => '4ee1623c8f3ddd152b3c1fc340b3ece3cbcf807efa2726307ea34e7d6d36a6c1'
+ },
+ {
+ 'type' => :dependency_file,
+ 'data' => {
+ 'input_file' => { 'name' => 'go.sum' },
+ 'package_manager' => { 'name' => 'go' },
+ 'language' => { 'name' => 'Go' }
+ },
+ 'fingerprint' => 'e78eee13d87248d5b7e3df21de67365a4996b3a547e033b8e8b180b24c300fd8'
+ }
+ ]
+ end
+
+ it 'stores each source with the given attributes' do
+ sources.each { |source| report.add_source(source) }
+
+ expect(report.sources.size).to eq(2)
+ expect(report.sources).to all(be_a(Gitlab::Ci::Reports::Sbom::Source))
+ end
+ end
+
+ describe '#add_component' do
+ let_it_be(:components) do
+ [
+ { 'type' => 'library', 'name' => 'component1', 'version' => 'v0.0.1' },
+ { 'type' => 'library', 'name' => 'component2', 'version' => 'v0.0.2' },
+ { 'type' => 'library', 'name' => 'component2' }
+ ]
+ end
+
+ it 'appends components to a list' do
+ components.each { |component| report.add_component(component) }
+
+ expect(report.components.size).to eq(3)
+ expect(report.components).to all(be_a(Gitlab::Ci::Reports::Sbom::Component))
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/reports/sbom/source_spec.rb b/spec/lib/gitlab/ci/reports/sbom/source_spec.rb
new file mode 100644
index 00000000000..f84ed85b651
--- /dev/null
+++ b/spec/lib/gitlab/ci/reports/sbom/source_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Reports::Sbom::Source do
+ let(:attributes) do
+ {
+ 'type' => :dependency_file,
+ 'data' => {
+ 'input_file' => { 'name' => 'package-lock.json' },
+ 'package_manager' => { 'name' => 'npm' },
+ 'language' => { 'name' => 'JavaScript' }
+ },
+ 'fingerprint' => '4ee1623c8f3ddd152b3c1fc340b3ece3cbcf807efa2726307ea34e7d6d36a6c1'
+ }
+ end
+
+ subject { described_class.new(**attributes) }
+
+ it 'has correct attributes' do
+ expect(subject).to have_attributes(
+ source_type: :dependency_file,
+ data: {
+ 'input_file' => { 'name' => 'package-lock.json' },
+ 'package_manager' => { 'name' => 'npm' },
+ 'language' => { 'name' => 'JavaScript' }
+ },
+ fingerprint: '4ee1623c8f3ddd152b3c1fc340b3ece3cbcf807efa2726307ea34e7d6d36a6c1'
+ )
+ end
+end
diff --git a/spec/lib/gitlab/database/bulk_update_spec.rb b/spec/lib/gitlab/database/bulk_update_spec.rb
index 08b4d50f83b..fa519cffd6b 100644
--- a/spec/lib/gitlab/database/bulk_update_spec.rb
+++ b/spec/lib/gitlab/database/bulk_update_spec.rb
@@ -91,7 +91,8 @@ RSpec.describe Gitlab::Database::BulkUpdate do
.to eq(['MR a', 'Issue a', 'Issue b'])
end
- context 'validates prepared_statements support', :reestablished_active_record_base do
+ context 'validates prepared_statements support', :reestablished_active_record_base,
+ :suppress_gitlab_schemas_validate_connection do
using RSpec::Parameterized::TableSyntax
where(:prepared_statements) do
diff --git a/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb b/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
index 34eb64997c1..90b588750dd 100644
--- a/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
+++ b/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
@@ -358,7 +358,11 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do
end
it 'returns true for deeply wrapped/nested errors' do
- top = twice_wrapped_exception(ActionView::Template::Error, ActiveRecord::StatementInvalid, ActiveRecord::ConnectionNotEstablished)
+ top = twice_wrapped_exception(
+ ActionView::Template::Error,
+ ActiveRecord::StatementInvalid,
+ ActiveRecord::ConnectionNotEstablished
+ )
expect(lb.connection_error?(top)).to eq(true)
end
diff --git a/spec/lib/gitlab/database/load_balancing_spec.rb b/spec/lib/gitlab/database/load_balancing_spec.rb
index f320fe0276f..76dfaa74ae6 100644
--- a/spec/lib/gitlab/database/load_balancing_spec.rb
+++ b/spec/lib/gitlab/database/load_balancing_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Gitlab::Database::LoadBalancing do
+RSpec.describe Gitlab::Database::LoadBalancing, :suppress_gitlab_schemas_validate_connection do
describe '.base_models' do
it 'returns the models to apply load balancing to' do
models = described_class.base_models
diff --git a/spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb b/spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb
index 1009ec354c3..e43cfe0814e 100644
--- a/spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb
+++ b/spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb
@@ -5,6 +5,13 @@ require 'spec_helper'
RSpec.describe Gitlab::Database::MigrationHelpers::RestrictGitlabSchema, query_analyzers: false, stub_feature_flags: false do
let(:schema_class) { Class.new(Gitlab::Database::Migration[1.0]).include(described_class) }
+ # We keep only the GitlabSchemasValidateConnection analyzer running
+ around do |example|
+ Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection.with_suppressed(false) do
+ example.run
+ end
+ end
+
describe '#restrict_gitlab_migration' do
it 'invalid schema raises exception' do
expect { schema_class.restrict_gitlab_migration gitlab_schema: :gitlab_non_exisiting }
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb
index c289277d6be..091e8dcd8b4 100644
--- a/spec/lib/gitlab/database/migration_helpers_spec.rb
+++ b/spec/lib/gitlab/database/migration_helpers_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
end
describe 'overridden dynamic model helpers' do
- let(:test_table) { '__test_batching_table' }
+ let(:test_table) { '_test_batching_table' }
before do
model.connection.execute(<<~SQL)
diff --git a/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection_spec.rb b/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection_spec.rb
index 5e8afc0102e..ddf5793049d 100644
--- a/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection_spec.rb
+++ b/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection_spec.rb
@@ -5,6 +5,13 @@ require 'spec_helper'
RSpec.describe Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection, query_analyzers: false do
let(:analyzer) { described_class }
+ # We keep only the GitlabSchemasValidateConnection analyzer running
+ around do |example|
+ Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection.with_suppressed(false) do
+ example.run
+ end
+ end
+
context 'properly observes all queries', :request_store do
using RSpec::Parameterized::TableSyntax
@@ -61,6 +68,24 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection
end
end
+ context "when analyzer is enabled for tests", :query_analyzers do
+ before do
+ skip_if_multiple_databases_not_setup
+ end
+
+ it "throws an error when trying to access a table that belongs to the gitlab_main schema from the ci database" do
+ expect do
+ Ci::ApplicationRecord.connection.execute("select * from users limit 1")
+ end.to raise_error(Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection::CrossSchemaAccessError)
+ end
+
+ it "throws an error when trying to access a table that belongs to the gitlab_ci schema from the main database" do
+ expect do
+ ApplicationRecord.connection.execute("select * from ci_builds limit 1")
+ end.to raise_error(Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection::CrossSchemaAccessError)
+ end
+ end
+
def process_sql(model, sql)
Gitlab::Database::QueryAnalyzer.instance.within([analyzer]) do
# Skip load balancer and retrieve connection assigned to model
diff --git a/spec/lib/gitlab/usage/service_ping_report_spec.rb b/spec/lib/gitlab/usage/service_ping_report_spec.rb
index 1e8f9db4dea..7a37a31b195 100644
--- a/spec/lib/gitlab/usage/service_ping_report_spec.rb
+++ b/spec/lib/gitlab/usage/service_ping_report_spec.rb
@@ -111,8 +111,12 @@ RSpec.describe Gitlab::Usage::ServicePingReport, :use_clean_rails_memory_store_c
# Because test cases are run inside a transaction, if any query raise and error all queries that follows
# it are automatically canceled by PostgreSQL, to avoid that problem, and to provide exhaustive information
# about every metric, queries are wrapped explicitly in sub transactions.
- ApplicationRecord.transaction do
- ApplicationRecord.connection.execute(query)&.first&.values&.first
+ table = PgQuery.parse(query).tables.first
+ gitlab_schema = Gitlab::Database::GitlabSchema.tables_to_schema[table]
+ base_model = gitlab_schema == :gitlab_main ? ApplicationRecord : Ci::ApplicationRecord
+
+ base_model.transaction do
+ base_model.connection.execute(query)&.first&.values&.first
end
rescue ActiveRecord::StatementInvalid => e
e.message
diff --git a/spec/lib/marginalia_spec.rb b/spec/lib/marginalia_spec.rb
index 693b7bd45c9..3c8dea547a9 100644
--- a/spec/lib/marginalia_spec.rb
+++ b/spec/lib/marginalia_spec.rb
@@ -11,6 +11,11 @@ RSpec.describe 'Marginalia spec' do
render body: nil
end
+ def first_ci_pipeline
+ Ci::Pipeline.first
+ render body: nil
+ end
+
private
[:auth_user, :current_user, :set_experimentation_subject_id_cookie, :signed_in?].each do |method|
@@ -36,7 +41,7 @@ RSpec.describe 'Marginalia spec' do
describe 'For rails web requests' do
let(:correlation_id) { SecureRandom.uuid }
- let(:recorded) { ActiveRecord::QueryRecorder.new { make_request(correlation_id) } }
+ let(:recorded) { ActiveRecord::QueryRecorder.new { make_request(correlation_id, :first_user) } }
let(:component_map) do
{
@@ -54,10 +59,11 @@ RSpec.describe 'Marginalia spec' do
end
context 'when using CI database' do
+ let(:recorded) { ActiveRecord::QueryRecorder.new { make_request(correlation_id, :first_ci_pipeline) } }
let(:component_map) do
{
"application" => "test",
- "endpoint_id" => "MarginaliaTestController#first_user",
+ "endpoint_id" => "MarginaliaTestController#first_ci_pipeline",
"correlation_id" => correlation_id,
"db_config_name" => 'ci'
}
@@ -65,8 +71,6 @@ RSpec.describe 'Marginalia spec' do
before do
skip_if_multiple_databases_not_setup
-
- allow(User).to receive(:connection) { Ci::ApplicationRecord.connection }
end
it 'generates a query that includes the component and value' do
@@ -140,11 +144,11 @@ RSpec.describe 'Marginalia spec' do
end
end
- def make_request(correlation_id)
+ def make_request(correlation_id, action_name)
request_env = Rack::MockRequest.env_for('/')
::Labkit::Correlation::CorrelationId.use_id(correlation_id) do
- MarginaliaTestController.action(:first_user).call(request_env)
+ MarginaliaTestController.action(action_name).call(request_env)
end
end
end
diff --git a/spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb b/spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb
index d35184e78a8..8dfeacc4774 100644
--- a/spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb
+++ b/spec/migrations/2021061716138_cascade_delete_freeze_periods_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
require_migration!
-RSpec.describe CascadeDeleteFreezePeriods do
+RSpec.describe CascadeDeleteFreezePeriods, :suppress_gitlab_schemas_validate_connection do
let(:namespace) { table(:namespaces).create!(name: 'deploy_freeze', path: 'deploy_freeze') }
let(:project) { table(:projects).create!(id: 1, namespace_id: namespace.id) }
let(:freeze_periods) { table(:ci_freeze_periods) }
diff --git a/spec/migrations/20210818185845_backfill_projects_with_coverage_spec.rb b/spec/migrations/20210818185845_backfill_projects_with_coverage_spec.rb
index 29f554a003b..13a6aa5413e 100644
--- a/spec/migrations/20210818185845_backfill_projects_with_coverage_spec.rb
+++ b/spec/migrations/20210818185845_backfill_projects_with_coverage_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe BackfillProjectsWithCoverage do
+RSpec.describe BackfillProjectsWithCoverage, :suppress_gitlab_schemas_validate_connection do
let(:projects) { table(:projects) }
let(:ci_pipelines) { table(:ci_pipelines) }
let(:ci_daily_build_group_report_results) { table(:ci_daily_build_group_report_results) }
diff --git a/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb b/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
index c1d96f50dc8..cf6a033b4b8 100644
--- a/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
+++ b/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
require_migration!
-RSpec.describe ScheduleRemoveOccurrencePipelinesAndDuplicateVulnerabilitiesFindings, :migration do
+RSpec.describe ScheduleRemoveOccurrencePipelinesAndDuplicateVulnerabilitiesFindings,
+ :suppress_gitlab_schemas_validate_connection, :migration do
let_it_be(:background_migration_jobs) { table(:background_migration_jobs) }
let_it_be(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') }
let_it_be(:users) { table(:users) }
diff --git a/spec/migrations/20220124130028_dedup_runner_projects_spec.rb b/spec/migrations/20220124130028_dedup_runner_projects_spec.rb
index 127f4798f33..3429ccc4df1 100644
--- a/spec/migrations/20220124130028_dedup_runner_projects_spec.rb
+++ b/spec/migrations/20220124130028_dedup_runner_projects_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe DedupRunnerProjects, :migration, schema: 20220120085655 do
+RSpec.describe DedupRunnerProjects, :migration, :suppress_gitlab_schemas_validate_connection, schema: 20220120085655 do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:runners) { table(:ci_runners) }
diff --git a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb
index a48464befdf..3478305bbad 100644
--- a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb
+++ b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!('remove_dangling_running_builds')
-RSpec.describe RemoveDanglingRunningBuilds do
+RSpec.describe RemoveDanglingRunningBuilds, :suppress_gitlab_schemas_validate_connection do
let(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') }
let(:project) { table(:projects).create!(namespace_id: namespace.id) }
let(:runner) { table(:ci_runners).create!(runner_type: 1) }
diff --git a/spec/migrations/associate_existing_dast_builds_with_variables_spec.rb b/spec/migrations/associate_existing_dast_builds_with_variables_spec.rb
index 74429e498df..d57a243bade 100644
--- a/spec/migrations/associate_existing_dast_builds_with_variables_spec.rb
+++ b/spec/migrations/associate_existing_dast_builds_with_variables_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe AssociateExistingDastBuildsWithVariables do
+RSpec.describe AssociateExistingDastBuildsWithVariables, :suppress_gitlab_schemas_validate_connection do
subject(:migration) { described_class.new }
let_it_be(:namespaces_table) { table(:namespaces) }
diff --git a/spec/migrations/clean_up_pending_builds_table_spec.rb b/spec/migrations/clean_up_pending_builds_table_spec.rb
index 9c8d4413337..17e62e1b486 100644
--- a/spec/migrations/clean_up_pending_builds_table_spec.rb
+++ b/spec/migrations/clean_up_pending_builds_table_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe CleanUpPendingBuildsTable do
+RSpec.describe CleanUpPendingBuildsTable, :suppress_gitlab_schemas_validate_connection do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:queue) { table(:ci_pending_builds) }
diff --git a/spec/migrations/delete_security_findings_without_uuid_spec.rb b/spec/migrations/delete_security_findings_without_uuid_spec.rb
index b32ea89f8aa..bfd89f1aa82 100644
--- a/spec/migrations/delete_security_findings_without_uuid_spec.rb
+++ b/spec/migrations/delete_security_findings_without_uuid_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe DeleteSecurityFindingsWithoutUuid do
+RSpec.describe DeleteSecurityFindingsWithoutUuid, :suppress_gitlab_schemas_validate_connection do
let(:users) { table(:users) }
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
diff --git a/spec/migrations/disable_job_token_scope_when_unused_spec.rb b/spec/migrations/disable_job_token_scope_when_unused_spec.rb
index d969c98aa0f..ef78698caf7 100644
--- a/spec/migrations/disable_job_token_scope_when_unused_spec.rb
+++ b/spec/migrations/disable_job_token_scope_when_unused_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe DisableJobTokenScopeWhenUnused do
+RSpec.describe DisableJobTokenScopeWhenUnused, :suppress_gitlab_schemas_validate_connection do
let(:ci_cd_settings) { table(:project_ci_cd_settings) }
let(:links) { table(:ci_job_token_project_scope_links) }
let(:namespaces) { table(:namespaces) }
diff --git a/spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb b/spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb
index 2108adcc973..01805a9eb79 100644
--- a/spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb
+++ b/spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe MigrateProtectedAttributeToPendingBuilds do
+RSpec.describe MigrateProtectedAttributeToPendingBuilds, :suppress_gitlab_schemas_validate_connection do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:queue) { table(:ci_pending_builds) }
diff --git a/spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb b/spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb
index 8a9b993b869..45a2772adda 100644
--- a/spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb
+++ b/spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb
@@ -3,7 +3,8 @@
require 'spec_helper'
require_migration!
-RSpec.describe ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes do
+RSpec.describe ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes,
+ :suppress_gitlab_schemas_validate_connection do
let(:namespaces) { table(:namespaces) }
let(:pipelines) { table(:ci_pipelines) }
let(:projects) { table(:projects) }
diff --git a/spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb b/spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb
index 012c7d065fc..f5d461cfce2 100644
--- a/spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb
+++ b/spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe ScheduleCopyCiBuildsColumnsToSecurityScans2 do
+RSpec.describe ScheduleCopyCiBuildsColumnsToSecurityScans2, :suppress_gitlab_schemas_validate_connection do
let_it_be(:namespaces) { table(:namespaces) }
let_it_be(:projects) { table(:projects) }
let_it_be(:ci_pipelines) { table(:ci_pipelines) }
diff --git a/spec/migrations/schedule_populate_status_column_of_security_scans_spec.rb b/spec/migrations/schedule_populate_status_column_of_security_scans_spec.rb
index 601935db8db..36b5df31661 100644
--- a/spec/migrations/schedule_populate_status_column_of_security_scans_spec.rb
+++ b/spec/migrations/schedule_populate_status_column_of_security_scans_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe SchedulePopulateStatusColumnOfSecurityScans do
+RSpec.describe SchedulePopulateStatusColumnOfSecurityScans, :suppress_gitlab_schemas_validate_connection do
before do
allow(Gitlab).to receive(:ee?).and_return(ee?)
stub_const("#{described_class.name}::BATCH_SIZE", 1)
diff --git a/spec/migrations/start_backfill_ci_queuing_tables_spec.rb b/spec/migrations/start_backfill_ci_queuing_tables_spec.rb
index a1e4179efb6..08fd244089f 100644
--- a/spec/migrations/start_backfill_ci_queuing_tables_spec.rb
+++ b/spec/migrations/start_backfill_ci_queuing_tables_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
-RSpec.describe StartBackfillCiQueuingTables do
+RSpec.describe StartBackfillCiQueuingTables, :suppress_gitlab_schemas_validate_connection do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:builds) { table(:ci_builds) }
diff --git a/spec/support/database/gitlab_schemas_validate_connection.rb b/spec/support/database/gitlab_schemas_validate_connection.rb
new file mode 100644
index 00000000000..118c6ea5001
--- /dev/null
+++ b/spec/support/database/gitlab_schemas_validate_connection.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+RSpec.configure do |config|
+ def with_gitlab_schemas_validate_connection_prevented
+ Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection.with_suppressed do
+ yield
+ end
+ end
+
+ config.around(:each, :suppress_gitlab_schemas_validate_connection) do |example|
+ with_gitlab_schemas_validate_connection_prevented(&example)
+ end
+
+ config.around(:each, query_analyzers: false) do |example|
+ with_gitlab_schemas_validate_connection_prevented(&example)
+ end
+end
diff --git a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb
index 1da21633504..07af193900a 100644
--- a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb
+++ b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_database|
+RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_database, table_name|
include ExclusiveLeaseHelpers
describe 'defining the job attributes' do
@@ -136,8 +136,10 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d
let(:job_interval) { 5.minutes }
let(:lease_timeout) { 15.minutes }
let(:lease_key) { described_class.name.demodulize.underscore }
- let(:migration) { build(:batched_background_migration, :active, interval: job_interval) }
let(:interval_variance) { described_class::INTERVAL_VARIANCE }
+ let(:migration) do
+ build(:batched_background_migration, :active, interval: job_interval, table_name: table_name)
+ end
before do
allow(Gitlab::Database::BackgroundMigration::BatchedMigration).to receive(:active_migration)
@@ -249,7 +251,7 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d
create(
:batched_background_migration,
:active,
- table_name: table_name,
+ table_name: new_table_name,
column_name: :id,
max_value: migration_records,
batch_size: batch_size,
@@ -261,14 +263,14 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d
end
let(:base_model) { Gitlab::Database.database_base_models[tracking_database] }
- let(:table_name) { 'example_data' }
+ let(:new_table_name) { '_test_example_data' }
let(:batch_size) { 5 }
let(:sub_batch_size) { 2 }
let(:number_of_batches) { 10 }
let(:migration_records) { batch_size * number_of_batches }
let(:connection) { Gitlab::Database.database_base_models[tracking_database].connection }
- let(:example_data) { define_batchable_model(table_name, connection: connection) }
+ let(:example_data) { define_batchable_model(new_table_name, connection: connection) }
around do |example|
Gitlab::Database::SharedModel.using_connection(connection) do
@@ -283,16 +285,16 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d
# - one record beyond the migration's range
# - one record that doesn't match the migration job's batch condition
connection.execute(<<~SQL)
- CREATE TABLE #{table_name} (
+ CREATE TABLE #{new_table_name} (
id integer primary key,
some_column integer,
status smallint);
- INSERT INTO #{table_name} (id, some_column, status)
+ INSERT INTO #{new_table_name} (id, some_column, status)
SELECT generate_series, generate_series, 1
FROM generate_series(1, #{migration_records + 1});
- UPDATE #{table_name}
+ UPDATE #{new_table_name}
SET status = 0
WHERE some_column = #{migration_records - 5};
SQL
diff --git a/spec/support_specs/database/prevent_cross_joins_spec.rb b/spec/support_specs/database/prevent_cross_joins_spec.rb
index efeabd15b58..5a80d0c0203 100644
--- a/spec/support_specs/database/prevent_cross_joins_spec.rb
+++ b/spec/support_specs/database/prevent_cross_joins_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Database::PreventCrossJoins do
+RSpec.describe Database::PreventCrossJoins, :suppress_gitlab_schemas_validate_connection do
context 'when running in a default scope' do
context 'when only non-CI tables are used' do
it 'does not raise exception' do
diff --git a/spec/tasks/gitlab/background_migrations_rake_spec.rb b/spec/tasks/gitlab/background_migrations_rake_spec.rb
index bbd33f71e60..d8ce00a65e6 100644
--- a/spec/tasks/gitlab/background_migrations_rake_spec.rb
+++ b/spec/tasks/gitlab/background_migrations_rake_spec.rb
@@ -2,7 +2,7 @@
require 'rake_helper'
-RSpec.describe 'gitlab:background_migrations namespace rake tasks' do
+RSpec.describe 'gitlab:background_migrations namespace rake tasks', :suppress_gitlab_schemas_validate_connection do
before do
Rake.application.rake_require 'tasks/gitlab/background_migrations'
end
@@ -155,7 +155,7 @@ RSpec.describe 'gitlab:background_migrations namespace rake tasks' do
context 'with multiple databases' do
subject(:status_task) { run_rake_task('gitlab:background_migrations:status') }
- let(:base_models) { { 'main' => main_model, 'ci' => ci_model } }
+ let(:base_models) { { main: main_model, ci: ci_model } }
let(:main_model) { double(:model, connection: connection) }
let(:ci_model) { double(:model, connection: connection) }
diff --git a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb
index 29b80176ef8..b03e964ce87 100644
--- a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb
+++ b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb
@@ -2,7 +2,8 @@
require 'rake_helper'
-RSpec.describe 'gitlab:db:decomposition:rollback:bump_ci_sequences', :silence_stdout do
+RSpec.describe 'gitlab:db:decomposition:rollback:bump_ci_sequences', :silence_stdout,
+ :suppress_gitlab_schemas_validate_connection do
before :all do
Rake.application.rake_require 'tasks/gitlab/db/decomposition/rollback/bump_ci_sequences'
diff --git a/spec/tasks/gitlab/db/lock_writes_rake_spec.rb b/spec/tasks/gitlab/db/lock_writes_rake_spec.rb
index 341e1a3f56c..3eb6d35f3f9 100644
--- a/spec/tasks/gitlab/db/lock_writes_rake_spec.rb
+++ b/spec/tasks/gitlab/db/lock_writes_rake_spec.rb
@@ -2,7 +2,8 @@
require 'rake_helper'
-RSpec.describe 'gitlab:db:lock_writes', :silence_stdout, :reestablished_active_record_base do
+RSpec.describe 'gitlab:db:lock_writes', :silence_stdout, :reestablished_active_record_base,
+ :suppress_gitlab_schemas_validate_connection do
before :all do
Rake.application.rake_require 'active_record/railties/databases'
Rake.application.rake_require 'tasks/seed_fu'
diff --git a/spec/tasks/gitlab/db/validate_config_rake_spec.rb b/spec/tasks/gitlab/db/validate_config_rake_spec.rb
index 03d7504e8b1..ad15c7f0d1c 100644
--- a/spec/tasks/gitlab/db/validate_config_rake_spec.rb
+++ b/spec/tasks/gitlab/db/validate_config_rake_spec.rb
@@ -2,7 +2,7 @@
require 'rake_helper'
-RSpec.describe 'gitlab:db:validate_config', :silence_stdout do
+RSpec.describe 'gitlab:db:validate_config', :silence_stdout, :suppress_gitlab_schemas_validate_connection do
# We don't need to delete this data since it only modifies `ar_internal_metadata`
# which would not be cleaned either by `DbCleaner`
self.use_transactional_tests = false
diff --git a/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb b/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb
index 2b4a42060d9..dfe7a266be2 100644
--- a/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb
+++ b/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb
@@ -3,5 +3,5 @@
require 'spec_helper'
RSpec.describe Database::BatchedBackgroundMigration::CiDatabaseWorker, :clean_gitlab_redis_shared_state do
- it_behaves_like 'it runs batched background migration jobs', :ci
+ it_behaves_like 'it runs batched background migration jobs', :ci, :ci_builds
end
diff --git a/spec/workers/database/batched_background_migration_worker_spec.rb b/spec/workers/database/batched_background_migration_worker_spec.rb
index a6c7db60abe..e57bd7581c2 100644
--- a/spec/workers/database/batched_background_migration_worker_spec.rb
+++ b/spec/workers/database/batched_background_migration_worker_spec.rb
@@ -3,5 +3,5 @@
require 'spec_helper'
RSpec.describe Database::BatchedBackgroundMigrationWorker do
- it_behaves_like 'it runs batched background migration jobs', :main
+ it_behaves_like 'it runs batched background migration jobs', :main, :events
end
diff --git a/yarn.lock b/yarn.lock
index b89c6848cd0..d71e325d215 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3959,10 +3959,10 @@ core-js-pure@^3.0.0:
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
-core-js@^3.23.5:
- version "3.23.5"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.23.5.tgz#1f82b0de5eece800827a2f59d597509c67650475"
- integrity sha512-7Vh11tujtAZy82da4duVreQysIoO2EvVrur7y6IzZkH1IHPSekuDi8Vuw1+YKjkbfWLRD7Nc9ICQ/sIUDutcyg==
+core-js@^3.24.0:
+ version "3.24.0"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.24.0.tgz#4928d4e99c593a234eb1a1f9abd3122b04d3ac57"
+ integrity sha512-IeOyT8A6iK37Ep4kZDD423mpi6JfPRoPUdQwEWYiGolvn4o6j2diaRzNfDfpTdu3a5qMbrGUzKUpYpRY8jXCkQ==
core-js@~2.3.0:
version "2.3.0"