From d2485dbfedc4759eba5243e0d155e34494c4429b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 6 Jul 2023 09:07:41 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop.yml | 5 - .rubocop_todo/performance/regexp_match.yml | 96 +++++++++++++++++ .../rspec/missing_feature_category.yml | 1 - Gemfile.lock | 1 + .../stores/modules/batch_comments/actions.js | 14 ++- .../components/ci_environments_dropdown.vue | 27 ++--- .../components/ci_variable_modal.vue | 7 +- .../components/ci_variable_settings.vue | 5 + .../components/ci_variable_shared.vue | 21 ++-- .../design_management/pages/index.vue | 20 ++-- .../components/related_merge_requests.vue | 84 ++++++++------- .../notes/components/comment_form.vue | 4 +- .../notes/components/noteable_discussion.vue | 4 +- .../notes/components/noteable_note.vue | 13 +-- app/assets/javascripts/notes/utils.js | 14 ++- .../components/related_issues_block.vue | 81 +++++++------- .../source_viewer/source_viewer_new.vue | 6 ++ .../work_items/components/widget_wrapper.vue | 28 ++--- .../work_item_links/work_item_link_child.vue | 2 +- .../work_item_links/work_item_links.vue | 93 ++++++++-------- .../work_item_links/work_item_links_form.vue | 3 +- .../work_item_links/work_item_tree.vue | 8 +- app/assets/stylesheets/framework.scss | 1 + .../stylesheets/framework/new_card.scss | 94 ++++++++++++++++ .../merge_requests/drafts_controller.rb | 11 +- .../projects/settings/ci_cd_controller.rb | 1 - app/models/merge_request/metrics.rb | 2 +- app/models/namespaces/traversal/linear.rb | 15 +-- .../namespaces/traversal/linear_scopes.rb | 7 +- app/views/projects/branches/_panel.html.haml | 4 +- .../ci_limit_environment_scope.yml | 8 -- .../use_traversal_ids_for_ancestors.yml | 8 -- .../development/use_traversal_ids_roots.yml | 8 -- .../batched_background_migrations_metric.json | 18 ++++ ...8_batched_background_migrations_metric.yml | 24 +++++ ...ace_p_ci_builds_metadata_foreign_key_v5.rb | 26 +++++ ...ci_runner_machine_builds_foreign_key_v4.rb | 26 +++++ db/schema_migrations/20230704062132 | 1 + db/schema_migrations/20230704062136 | 1 + doc/administration/integration/plantuml.md | 4 +- .../package_information/defaults.md | 2 +- .../documentation/styleguide/index.md | 8 +- .../testing_guide/best_practices.md | 2 +- doc/integration/kerberos.md | 5 + doc/topics/git/lfs/index.md | 2 +- doc/user/profile/achievements.md | 2 +- gems/gitlab-rspec/.rubocop.yml | 12 +++ gems/gitlab-rspec/Gemfile.lock | 1 + gems/gitlab-rspec/gitlab-rspec.gemspec | 1 + gems/gitlab-rspec/lib/gitlab/rspec/all.rb | 4 + .../rspec/configurations/time_travel.rb | 32 ++++++ .../spec/gitlab/rspec}/time_travel_spec.rb | 11 +- lefthook.yml | 8 +- .../ci/runner/runner_fleet_pipeline_seeder.rb | 5 +- .../batched_background_migrations_metric.rb | 26 +++++ lib/tasks/gitlab/shell.rake | 51 ++------- locale/gitlab.pot | 6 +- qa/qa/page/base.rb | 5 + qa/qa/resource/issuable.rb | 2 +- qa/qa/resource/merge_request.rb | 7 +- .../merge_requests/drafts_controller_spec.rb | 24 +++++ .../components/draft_note_spec.js | 3 + .../modules/batch_comments/actions_spec.js | 27 +++++ .../ci_environments_dropdown_spec.js | 30 +++--- .../components/ci_variable_modal_spec.js | 5 +- .../components/ci_variable_settings_spec.js | 2 + .../components/ci_variable_shared_spec.js | 33 +----- spec/frontend/ci/ci_variable_list/mocks.js | 3 + .../components/related_issues_block_spec.js | 4 +- .../components/related_issues_root_spec.js | 101 ++++++++---------- .../notes/components/noteable_note_spec.js | 16 ++- spec/frontend/notes/utils_spec.js | 31 ++++-- .../source_viewer/source_viewer_new_spec.js | 6 ++ ...tched_background_migrations_metric_spec.rb | 27 +++++ spec/models/ci/runner_spec.rb | 3 +- spec/models/group_spec.rb | 8 -- spec/models/namespace_spec.rb | 32 ------ .../ci/process_sync_events_service_spec.rb | 4 +- spec/support/rspec_order_todo.yml | 1 - .../cascading_settings_shared_examples.rb | 8 -- .../namespaces/traversal_scope_examples.rb | 7 +- spec/support/time_travel.rb | 21 ---- spec/tasks/gitlab/shell_rake_spec.rb | 72 +++++++++++-- .../tooling/rspec_flaky/flaky_example_spec.rb | 1 - .../flaky_examples_collection_spec.rb | 2 +- spec/tooling/rspec_flaky/listener_spec.rb | 1 - spec/tooling/rspec_flaky/report_spec.rb | 3 +- tooling/bin/gettext_extractor | 17 +-- 88 files changed, 931 insertions(+), 549 deletions(-) create mode 100644 .rubocop_todo/performance/regexp_match.yml create mode 100644 app/assets/stylesheets/framework/new_card.scss delete mode 100644 config/feature_flags/development/ci_limit_environment_scope.yml delete mode 100644 config/feature_flags/development/use_traversal_ids_for_ancestors.yml delete mode 100644 config/feature_flags/development/use_traversal_ids_roots.yml create mode 100644 config/metrics/objects_schemas/batched_background_migrations_metric.json create mode 100644 config/metrics/settings/20230602180038_batched_background_migrations_metric.yml create mode 100644 db/post_migrate/20230704062132_replace_p_ci_builds_metadata_foreign_key_v5.rb create mode 100644 db/post_migrate/20230704062136_replace_p_ci_runner_machine_builds_foreign_key_v4.rb create mode 100644 db/schema_migrations/20230704062132 create mode 100644 db/schema_migrations/20230704062136 create mode 100644 gems/gitlab-rspec/lib/gitlab/rspec/configurations/time_travel.rb rename {spec/support_specs => gems/gitlab-rspec/spec/gitlab/rspec}/time_travel_spec.rb (78%) create mode 100644 lib/gitlab/usage/metrics/instrumentations/batched_background_migrations_metric.rb create mode 100644 spec/lib/gitlab/usage/metrics/instrumentations/batched_background_migrations_metric_spec.rb delete mode 100644 spec/support/time_travel.rb diff --git a/.rubocop.yml b/.rubocop.yml index 8c52516a21c..9c0fb76f68f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -490,11 +490,6 @@ Cop/InjectEnterpriseEditionModule: Style/ReturnNil: Enabled: true -# It isn't always safe to replace `=~` with `.match?`, especially when there are -# nil values on the left hand side -Performance/RegexpMatch: - Enabled: false - Cop/ActiveRecordAssociationReload: Enabled: true Exclude: diff --git a/.rubocop_todo/performance/regexp_match.yml b/.rubocop_todo/performance/regexp_match.yml new file mode 100644 index 00000000000..c1a8036f8d1 --- /dev/null +++ b/.rubocop_todo/performance/regexp_match.yml @@ -0,0 +1,96 @@ +--- +# Cop supports --autocorrect. +Performance/RegexpMatch: + Details: grace period + Exclude: + - 'app/controllers/concerns/internal_redirect.rb' + - 'app/controllers/import/bitbucket_server_controller.rb' + - 'app/finders/ci/pipelines_finder.rb' + - 'app/helpers/application_helper.rb' + - 'app/helpers/colors_helper.rb' + - 'app/helpers/emails_helper.rb' + - 'app/models/commit_range.rb' + - 'app/models/commit_status.rb' + - 'app/models/concerns/ignorable_columns.rb' + - 'app/models/external_issue.rb' + - 'app/models/hooks/web_hook_log.rb' + - 'app/models/projects/topic.rb' + - 'app/models/repository.rb' + - 'app/models/user.rb' + - 'app/services/bulk_imports/create_service.rb' + - 'app/services/clusters/cleanup/project_namespace_service.rb' + - 'app/services/clusters/cleanup/service_account_service.rb' + - 'app/services/projects/update_remote_mirror_service.rb' + - 'app/uploaders/file_uploader.rb' + - 'app/validators/abstract_path_validator.rb' + - 'app/validators/cluster_name_validator.rb' + - 'app/validators/devise_email_validator.rb' + - 'app/validators/line_code_validator.rb' + - 'config/initializers/wikicloth_redos_patch.rb' + - 'ee/app/controllers/concerns/audit_events/enforces_valid_date_params.rb' + - 'ee/lib/ee/banzai/filter/references/vulnerability_reference_filter.rb' + - 'ee/lib/elastic/latest/git_class_proxy.rb' + - 'ee/lib/gitlab/llm/chain/utils/text_processing.rb' + - 'ee/lib/gitlab/llm/open_ai/response_modifiers/tanuki_bot.rb' + - 'ee/lib/gitlab/middleware/ip_restrictor.rb' + - 'ee/spec/spec_helper.rb' + - 'lib/api/helpers.rb' + - 'lib/api/helpers/common_helpers.rb' + - 'lib/api/validations/validators/bulk_imports.rb' + - 'lib/banzai/color_parser.rb' + - 'lib/banzai/filter/ascii_doc_sanitization_filter.rb' + - 'lib/banzai/filter/references/abstract_reference_filter.rb' + - 'lib/banzai/filter/references/reference_filter.rb' + - 'lib/bulk_imports/path_normalization.rb' + - 'lib/feature/definition.rb' + - 'lib/gitlab/authorized_keys.rb' + - 'lib/gitlab/checks/branch_check.rb' + - 'lib/gitlab/ci/build/artifacts/metadata.rb' + - 'lib/gitlab/ci/build/artifacts/metadata/entry.rb' + - 'lib/gitlab/ci/project_config/remote.rb' + - 'lib/gitlab/database/postgres_constraint.rb' + - 'lib/gitlab/database/postgres_foreign_key.rb' + - 'lib/gitlab/database/postgres_index.rb' + - 'lib/gitlab/database/postgres_partition.rb' + - 'lib/gitlab/database/postgres_partitioned_table.rb' + - 'lib/gitlab/database/reindexing/reindex_concurrently.rb' + - 'lib/gitlab/dependency_linker/base_linker.rb' + - 'lib/gitlab/dependency_linker/composer_json_linker.rb' + - 'lib/gitlab/diff/parser.rb' + - 'lib/gitlab/email/reply_parser.rb' + - 'lib/gitlab/git/gitmodules_parser.rb' + - 'lib/gitlab/metrics/samplers/threads_sampler.rb' + - 'lib/gitlab/middleware/sidekiq_web_static.rb' + - 'lib/gitlab/middleware/static.rb' + - 'lib/gitlab/url_blocker.rb' + - 'lib/tasks/gitlab/update_templates.rake' + - 'lib/uploaded_file.rb' + - 'qa/qa/flow/integrations/slack.rb' + - 'qa/qa/git/location.rb' + - 'qa/qa/resource/api_fabricator.rb' + - 'qa/qa/runtime/search.rb' + - 'qa/qa/service/cluster_provider/k3d.rb' + - 'qa/qa/specs/spec_helper.rb' + - 'qa/qa/tools/ci/ff_changes.rb' + - 'rubocop/cop/project_path_helper.rb' + - 'rubocop/cop/qa/selector_usage.rb' + - 'scripts/changed-feature-flags' + - 'scripts/failed_tests.rb' + - 'scripts/lib/glfm/parse_examples.rb' + - 'scripts/lib/glfm/update_specification.rb' + - 'scripts/lint-docs-blueprints.rb' + - 'scripts/perf/query_limiting_report.rb' + - 'scripts/qa/testcases-check' + - 'scripts/trigger-build.rb' + - 'sidekiq_cluster/cli.rb' + - 'spec/lib/gitlab/cluster/mixins/puma_cluster_spec.rb' + - 'spec/mailers/emails/in_product_marketing_spec.rb' + - 'spec/spec_helper.rb' + - 'spec/support/capybara.rb' + - 'spec/support/helpers/test_env.rb' + - 'spec/support/shared_contexts/features/integrations/integrations_shared_context.rb' + - 'spec/support/shared_examples/features/discussion_comments_shared_example.rb' + - 'spec/tooling/quality/test_level_spec.rb' + - 'tooling/danger/analytics_instrumentation.rb' + - 'tooling/danger/database_dictionary.rb' + - 'tooling/danger/specs/feature_category_suggestion.rb' diff --git a/.rubocop_todo/rspec/missing_feature_category.yml b/.rubocop_todo/rspec/missing_feature_category.yml index 0392c1feb40..bc050a40a73 100644 --- a/.rubocop_todo/rspec/missing_feature_category.yml +++ b/.rubocop_todo/rspec/missing_feature_category.yml @@ -5565,7 +5565,6 @@ RSpec/MissingFeatureCategory: - 'spec/support_specs/helpers/stub_method_calls_spec.rb' - 'spec/support_specs/matchers/be_sorted_spec.rb' - 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb' - - 'spec/support_specs/time_travel_spec.rb' - 'spec/tasks/admin_mode_spec.rb' - 'spec/tasks/config_lint_rake_spec.rb' - 'spec/tasks/dev_rake_spec.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 7cb66152e99..a2a7a3f26ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,6 +16,7 @@ PATH remote: gems/gitlab-rspec specs: gitlab-rspec (0.1.0) + activesupport (>= 6.1, < 7.1) rspec (~> 3.0) PATH diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js index fc999cb0840..070ce38c8aa 100644 --- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js +++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js @@ -3,6 +3,7 @@ import { createAlert } from '~/alert'; import { scrollToElement } from '~/lib/utils/common_utils'; import { __ } from '~/locale'; import { FILE_DIFF_POSITION_TYPE } from '~/diffs/constants'; +import { updateNoteErrorMessage } from '~/notes/utils'; import { CHANGES_TAB, DISCUSSION_TAB, SHOW_TAB } from '../../../constants'; import service from '../../../services/drafts_service'; import * as types from './mutation_types'; @@ -109,7 +110,7 @@ export const updateDiscussionsAfterPublish = async ({ dispatch, getters, rootGet export const updateDraft = ( { commit, getters }, - { note, noteText, resolveDiscussion, position, callback }, + { note, noteText, resolveDiscussion, position, flashContainer, callback, errorCallback }, ) => { const params = { draftId: note.id, @@ -125,11 +126,14 @@ export const updateDraft = ( .then((res) => res.data) .then((data) => commit(types.RECEIVE_DRAFT_UPDATE_SUCCESS, data)) .then(callback) - .catch(() => + .catch((e) => { createAlert({ - message: __('An error occurred while updating the comment'), - }), - ); + message: updateNoteErrorMessage(e), + parent: flashContainer, + }); + + errorCallback(); + }); }; export const scrollToDraft = ({ dispatch, rootGetters }, draft) => { diff --git a/app/assets/javascripts/ci/ci_variable_list/components/ci_environments_dropdown.vue b/app/assets/javascripts/ci/ci_variable_list/components/ci_environments_dropdown.vue index eda0e8829a8..a25f871ac92 100644 --- a/app/assets/javascripts/ci/ci_variable_list/components/ci_environments_dropdown.vue +++ b/app/assets/javascripts/ci/ci_variable_list/components/ci_environments_dropdown.vue @@ -24,6 +24,10 @@ export default { type: Array, required: true, }, + hasEnvScopeQuery: { + type: Boolean, + required: true, + }, selectedEnvironmentScope: { type: String, required: false, @@ -48,22 +52,19 @@ export default { }); }, isDropdownLoading() { - return this.areEnvironmentsLoading && this.isEnvScopeLimited && !this.isDropdownShown; + return this.areEnvironmentsLoading && this.hasEnvScopeQuery && !this.isDropdownShown; }, isDropdownSearching() { - return this.areEnvironmentsLoading && this.isEnvScopeLimited && this.isDropdownShown; - }, - isEnvScopeLimited() { - return this.glFeatures?.ciLimitEnvironmentScope; + return this.areEnvironmentsLoading && this.hasEnvScopeQuery && this.isDropdownShown; }, searchedEnvironments() { - // If FF is enabled, search query will be fired so this component will already - // receive filtered environments during the refetch. - // If FF is disabled, search the existing list of environments in the frontend - let filtered = this.isEnvScopeLimited ? this.environments : this.filteredEnvironments; + // If hasEnvScopeQuery (applies only to projects for now), search query will be fired so this + // component will already receive filtered environments during the refetch. + // Otherwise (applies to groups), search the existing list of environments in the frontend + let filtered = this.hasEnvScopeQuery ? this.environments : this.filteredEnvironments; // If there is no search term, make sure to include * - if (this.isEnvScopeLimited && !this.searchTerm) { + if (this.hasEnvScopeQuery && !this.searchTerm) { filtered = uniq([...filtered, '*']); } @@ -77,7 +78,7 @@ export default { }, shouldRenderDivider() { return ( - (this.isEnvScopeLimited || this.shouldRenderCreateButton) && !this.areEnvironmentsLoading + (this.hasEnvScopeQuery || this.shouldRenderCreateButton) && !this.areEnvironmentsLoading ); }, environmentScopeLabel() { @@ -88,7 +89,7 @@ export default { debouncedSearch: debounce(function debouncedSearch(searchTerm) { const newSearchTerm = searchTerm.trim(); this.searchTerm = newSearchTerm; - if (this.isEnvScopeLimited) { + if (this.hasEnvScopeQuery) { this.$emit('search-environment-scope', newSearchTerm); } }, 500), @@ -128,7 +129,7 @@ export default { >