From 919e3e3cd83e76dba137ef9bcc4746214c2085ff Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 7 Feb 2023 21:09:58 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .gitlab/merge_request_templates/Deprecations.md | 15 ++--- .rubocop_todo/rspec/invalid_feature_category.yml | 70 ---------------------- .../components/mr_widget_pipeline.vue | 2 +- app/controllers/application_controller.rb | 2 - .../concerns/preferred_language_switcher.rb | 2 - app/controllers/import/github_controller.rb | 17 ++++++ .../mutations/ci/job_token_scope/remove_project.rb | 9 ++- app/models/ci/job_token/project_scope_link.rb | 5 +- app/models/project.rb | 1 + app/serializers/ci/pipeline_entity.rb | 1 - app/serializers/merge_requests/pipeline_entity.rb | 4 -- .../ci/job_token_scope/remove_project_service.rb | 6 +- app/services/users/build_service.rb | 6 +- .../devise/shared/_language_switcher.html.haml | 2 - app/workers/bulk_imports/pipeline_worker.rb | 7 +++ .../development/preferred_language_switcher.yml | 7 --- config/routes/import.rb | 1 + doc/api/graphql/reference/index.md | 1 + doc/integration/security_partners/index.md | 1 + doc/user/group/contribution_analytics/index.md | 30 ++++++---- doc/user/group/import/index.md | 7 ++- lib/bulk_imports/pipeline.rb | 1 + locale/gitlab.pot | 3 + ...pipelines#index-get_list_project_pipelines.json | 3 - spec/controllers/import/github_controller_spec.rb | 54 ++++++++++++++++- spec/controllers/registrations_controller_spec.rb | 2 +- .../user_can_see_draft_toggle_spec.rb | 2 +- .../projects/issues/email_participants_spec.rb | 2 +- .../projects/snippets/create_snippet_spec.rb | 2 +- spec/features/projects/snippets/show_spec.rb | 2 +- .../snippets/user_comments_on_snippet_spec.rb | 2 +- .../projects/snippets/user_deletes_snippet_spec.rb | 2 +- .../projects/snippets/user_updates_snippet_spec.rb | 2 +- .../projects/snippets/user_views_snippets_spec.rb | 2 +- spec/features/snippets_spec.rb | 2 +- spec/features/users/snippets_spec.rb | 2 +- spec/frontend/pipelines/mock_data.js | 2 - .../components/mr_widget_pipeline_spec.js | 2 - .../ci/job_token_scope/remove_project_spec.rb | 34 +++++++++-- spec/helpers/issuables_helper_spec.rb | 4 +- .../common/pipelines/uploads_pipeline_spec.rb | 2 +- .../migrations/batched_migration_last_id_spec.rb | 2 +- spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb | 2 +- spec/lib/gitlab/github_import/client_spec.rb | 2 +- .../lib/gitlab/github_import/clients/proxy_spec.rb | 2 +- .../gitlab/import_export/version_checker_spec.rb | 2 +- ...eftover_external_pull_request_deletions_spec.rb | 2 +- ...move_leftover_ci_job_artifact_deletions_spec.rb | 2 +- ...ove_deactivated_user_highest_role_stats_spec.rb | 2 +- ..._import_sources_on_application_settings_spec.rb | 2 +- ..._import_sources_on_application_settings_spec.rb | 2 +- spec/models/integrations/apple_app_store_spec.rb | 2 +- spec/models/issue_spec.rb | 2 +- spec/models/project_spec.rb | 10 ++++ spec/models/resource_event_spec.rb | 2 +- spec/models/resource_label_event_spec.rb | 2 +- spec/models/resource_milestone_event_spec.rb | 2 +- spec/models/resource_state_event_spec.rb | 2 +- spec/policies/global_policy_spec.rb | 2 +- spec/policies/todo_policy_spec.rb | 2 +- .../ci/job_token_scope/remove_project_spec.rb | 3 +- .../mutations/ci/pipeline_schedule_play_spec.rb | 2 +- .../api/graphql/project/project_statistics_spec.rb | 2 +- spec/routing/import_routing_spec.rb | 4 ++ spec/serializers/ci/pipeline_entity_spec.rb | 3 +- .../merge_requests/pipeline_entity_spec.rb | 3 +- spec/services/lfs/file_transformer_spec.rb | 2 +- spec/services/notes/create_service_spec.rb | 2 +- .../ci_configuration/sast_create_service_spec.rb | 3 +- .../users/assigned_issues_count_service_spec.rb | 2 +- .../security/update_banned_ssh_keys_rake_spec.rb | 2 +- spec/views/layouts/snippets.html.haml_spec.rb | 2 +- spec/views/projects/commit/show.html.haml_spec.rb | 2 +- spec/workers/bulk_imports/pipeline_worker_spec.rb | 34 +++++++++++ 74 files changed, 254 insertions(+), 181 deletions(-) delete mode 100644 config/feature_flags/development/preferred_language_switcher.yml diff --git a/.gitlab/merge_request_templates/Deprecations.md b/.gitlab/merge_request_templates/Deprecations.md index 8f1d7363a42..841ef70d92a 100644 --- a/.gitlab/merge_request_templates/Deprecations.md +++ b/.gitlab/merge_request_templates/Deprecations.md @@ -1,10 +1,5 @@ -/label ~"release post" ~"release post item" ~"Technical Writing" ~devops:: ~group:: ~"release post item::deprecation" -/label ~"type::maintenance" -/milestone % -/assign `@EM/PM` (choose the DRI; remove backticks here, and below) - **Be sure to link this MR to the relevant deprecation issue(s).** - Deprecation Issue: @@ -42,10 +37,12 @@ They are frequently updated, and everyone should make sure they are aware of the - [ ] Set yourself as the Assignee, meaning you are the DRI. - [ ] If the deprecation is a [breaking change](https://about.gitlab.com/handbook/product/gitlab-the-product/#breaking-change), add label `breaking change`. +- [ ] Confirm this MR is labeled ~"release post item::deprecation" - [ ] Follow the process to [create a deprecation YAML file](https://about.gitlab.com/handbook/marketing/blog/release-posts/#creating-a-deprecation-entry). -- [ ] Make sure that the milestone dates are based on the dates in [Product milestone creation](https://about.gitlab.com/handbook/product/milestones/#product-milestone-creation). - [ ] Add reviewers by the 10th. -- [ ] When ready to be merged and not later than the 15th, add the `~ready` label and @ message the TW for final review and merge. +- [ ] Add scoped `devops::` and `group::` labels as necessary. +- [ ] Add the appropriate milestone to this MR. +- [ ] When ready to be merged (and no later than the 15th) `@mention` the TW for final review and merge. ## Reviewers @@ -106,3 +103,7 @@ must be updated before this MR is merged: 1. Set the MR to merge when the pipeline succeeds (or merge if the pipeline is already complete). If you have trouble running the Rake task, check the [troubleshooting steps](https://about.gitlab.com/handbook/marketing/blog/release-posts/#deprecation-rake-task-troubleshooting). + +/label ~"release post" ~"release post item" ~"Technical Writing" ~"release post item::deprecation" +/label ~"type::maintenance" +/label ~"maintenance::refactor" diff --git a/.rubocop_todo/rspec/invalid_feature_category.yml b/.rubocop_todo/rspec/invalid_feature_category.yml index 469c0e2a8a8..fc5cb5eba93 100644 --- a/.rubocop_todo/rspec/invalid_feature_category.yml +++ b/.rubocop_todo/rspec/invalid_feature_category.yml @@ -1,6 +1,5 @@ --- RSpec/InvalidFeatureCategory: - Details: grace period Exclude: - 'ee/spec/controllers/admin/application_settings_controller_spec.rb' - 'ee/spec/controllers/admin/applications_controller_spec.rb' @@ -8,44 +7,16 @@ RSpec/InvalidFeatureCategory: - 'ee/spec/controllers/admin/emails_controller_spec.rb' - 'ee/spec/controllers/countries_controller_spec.rb' - 'ee/spec/controllers/country_states_controller_spec.rb' - - 'ee/spec/controllers/ee/projects/autocomplete_sources_controller_spec.rb' - - 'ee/spec/controllers/groups/analytics/tasks_by_type_controller_spec.rb' - 'ee/spec/controllers/sitemap_controller_spec.rb' - 'ee/spec/features/admin/admin_dashboard_spec.rb' - - 'ee/spec/features/admin/admin_emails_spec.rb' - 'ee/spec/features/dashboards/operations_spec.rb' - - 'ee/spec/features/groups/show_spec.rb' - - 'ee/spec/features/security/project/snippet/internal_access_spec.rb' - - 'ee/spec/features/security/project/snippet/private_access_spec.rb' - - 'ee/spec/features/security/project/snippet/public_access_spec.rb' - - 'ee/spec/features/work_items/okr_spec.rb' - - 'ee/spec/finders/work_items/widgets/filters/requirement_legacy_spec.rb' - - 'ee/spec/graphql/ee/resolvers/work_items_resolver_spec.rb' - - 'ee/spec/graphql/types/pipeline_security_report_finding_type_spec.rb' - - 'ee/spec/helpers/application_helper_spec.rb' - - 'ee/spec/lib/ee/gitlab/ci/pipeline/chain/validate/abilities_spec.rb' - - 'ee/spec/lib/gitlab/ci/reports/license_scanning/report_spec.rb' - - 'ee/spec/models/resource_iteration_event_spec.rb' - - 'ee/spec/models/resource_weight_event_spec.rb' - - 'ee/spec/models/work_items/widgets/requirement_legacy_spec.rb' - - 'ee/spec/policies/global_policy_spec.rb' - 'ee/spec/requests/api/award_emoji_spec.rb' - 'ee/spec/requests/api/settings_spec.rb' - - 'ee/spec/requests/ee/groups/autocomplete_sources_spec.rb' - - 'ee/spec/serializers/autocomplete/iteration_entity_spec.rb' - - 'ee/spec/services/ee/groups/autocomplete_service_spec.rb' - - 'ee/spec/services/ee/merge_requests/after_create_service_spec.rb' - - 'ee/spec/services/ee/projects/autocomplete_service_spec.rb' - - 'ee/spec/services/vulnerability_feedback/create_service_spec.rb' - - 'ee/spec/services/work_items/widgets/iteration_service/create_service_spec.rb' - - 'ee/spec/services/work_items/widgets/iteration_service/update_service_spec.rb' - 'spec/config/inject_enterprise_edition_module_spec.rb' - 'spec/config/object_store_settings_spec.rb' - 'spec/config/smime_signature_settings_spec.rb' - 'spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb' - 'spec/controllers/concerns/content_security_policy_patch_spec.rb' - - 'spec/controllers/import/github_controller_spec.rb' - - 'spec/controllers/registrations_controller_spec.rb' - 'spec/features/action_cable_logging_spec.rb' - 'spec/features/admin/admin_abuse_reports_spec.rb' - 'spec/features/admin/admin_appearance_spec.rb' @@ -60,54 +31,23 @@ RSpec/InvalidFeatureCategory: - 'spec/features/frequently_visited_projects_and_groups_spec.rb' - 'spec/features/help_dropdown_spec.rb' - 'spec/features/help_pages_spec.rb' - - 'spec/features/merge_request/user_can_see_draft_toggle_spec.rb' - 'spec/features/monitor_sidebar_link_spec.rb' - - 'spec/features/projects/issues/email_participants_spec.rb' - - 'spec/features/projects/snippets/create_snippet_spec.rb' - - 'spec/features/projects/snippets/show_spec.rb' - - 'spec/features/projects/snippets/user_comments_on_snippet_spec.rb' - - 'spec/features/projects/snippets/user_deletes_snippet_spec.rb' - - 'spec/features/projects/snippets/user_updates_snippet_spec.rb' - - 'spec/features/projects/snippets/user_views_snippets_spec.rb' - - 'spec/features/snippets_spec.rb' - 'spec/features/unsubscribe_links_spec.rb' - - 'spec/features/users/snippets_spec.rb' - 'spec/features/whats_new_spec.rb' - - 'spec/helpers/issuables_helper_spec.rb' - 'spec/lib/api/base_spec.rb' - 'spec/lib/api/helpers_spec.rb' - - 'spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb' - 'spec/lib/gitlab/application_context_spec.rb' - - 'spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb' - - 'spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb' - 'spec/lib/gitlab/error_tracking/context_payload_generator_spec.rb' - 'spec/lib/gitlab/error_tracking_spec.rb' - - 'spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb' - - 'spec/lib/gitlab/github_import/client_spec.rb' - - 'spec/lib/gitlab/github_import/clients/proxy_spec.rb' - 'spec/lib/gitlab/graphql/tracers/logger_tracer_spec.rb' - 'spec/lib/gitlab/graphql/tracers/metrics_tracer_spec.rb' - - 'spec/lib/gitlab/import_export/version_checker_spec.rb' - 'spec/lib/gitlab/metrics/background_transaction_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/worker_context/client_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/worker_context/server_spec.rb' - 'spec/lib/gitlab/slug/path_spec.rb' - 'spec/lib/gitlab/utils/strong_memoize_spec.rb' - - 'spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb' - - 'spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb' - - 'spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb' - - 'spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb' - - 'spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb' - 'spec/models/application_setting_spec.rb' - - 'spec/models/integrations/apple_app_store_spec.rb' - - 'spec/models/issue_spec.rb' - 'spec/models/namespaces/randomized_suffix_path_spec.rb' - - 'spec/models/resource_event_spec.rb' - - 'spec/models/resource_label_event_spec.rb' - - 'spec/models/resource_milestone_event_spec.rb' - - 'spec/models/resource_state_event_spec.rb' - - 'spec/policies/global_policy_spec.rb' - - 'spec/policies/todo_policy_spec.rb' - 'spec/requests/admin/version_check_controller_spec.rb' - 'spec/requests/api/admin/plan_limits_spec.rb' - 'spec/requests/api/admin/sidekiq_spec.rb' @@ -115,16 +55,13 @@ RSpec/InvalidFeatureCategory: - 'spec/requests/api/api_guard/response_coercer_middleware_spec.rb' - 'spec/requests/api/award_emoji_spec.rb' - 'spec/requests/api/graphql/custom_emoji_query_spec.rb' - - 'spec/requests/api/graphql/gitlab_schema_spec.rb' - 'spec/requests/api/graphql/multiplexed_queries_spec.rb' - 'spec/requests/api/graphql/mutations/admin/sidekiq_queues/delete_jobs_spec.rb' - 'spec/requests/api/graphql/mutations/award_emojis/add_spec.rb' - 'spec/requests/api/graphql/mutations/award_emojis/remove_spec.rb' - 'spec/requests/api/graphql/mutations/award_emojis/toggle_spec.rb' - - 'spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb' - 'spec/requests/api/graphql/mutations/custom_emoji/create_spec.rb' - 'spec/requests/api/graphql/mutations/custom_emoji/destroy_spec.rb' - - 'spec/requests/api/graphql/project/project_statistics_spec.rb' - 'spec/requests/api/graphql/query_spec.rb' - 'spec/requests/api/graphql_spec.rb' - 'spec/requests/api/internal/workhorse_spec.rb' @@ -136,10 +73,3 @@ RSpec/InvalidFeatureCategory: - 'spec/rubocop/cop/gitlab/doc_url_spec.rb' - 'spec/rubocop/cop/lint/last_keyword_argument_spec.rb' - 'spec/rubocop/cop/rspec/avoid_test_prof_spec.rb' - - 'spec/services/lfs/file_transformer_spec.rb' - - 'spec/services/notes/create_service_spec.rb' - - 'spec/services/security/ci_configuration/sast_create_service_spec.rb' - - 'spec/services/users/assigned_issues_count_service_spec.rb' - - 'spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb' - - 'spec/views/layouts/snippets.html.haml_spec.rb' - - 'spec/views/projects/commit/show.html.haml_spec.rb' diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index be1e570285a..1093e7cb2ee 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -199,7 +199,7 @@ export default { data-testid="pipeline-info-container" data-qa-selector="merge_request_pipeline_info_content" > - {{ pipeline.details.event_type_name || pipeline.details.name }} + {{ pipeline.details.event_type_name }} (project) { where(source_project: project) } - scope :with_target, ->(project) { where(target_project: project) } + scope :with_access_direction, ->(direction) { where(direction: direction) } + scope :with_source, ->(project) { where(source_project: project) } + scope :with_target, ->(project) { where(target_project: project) } validates :source_project, presence: true validates :target_project, presence: true diff --git a/app/models/project.rb b/app/models/project.rb index 8cb17632170..0012603466e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -825,6 +825,7 @@ class Project < ApplicationRecord scope :for_group, -> (group) { where(group: group) } scope :for_group_and_its_subgroups, ->(group) { where(namespace_id: group.self_and_descendants.select(:id)) } scope :for_group_and_its_ancestor_groups, ->(group) { where(namespace_id: group.self_and_ancestors.select(:id)) } + scope :is_importing, -> { with_import_state.where(import_state: { status: %w[started scheduled] }) } class << self # Searches for a list of projects based on the query given in `query`. diff --git a/app/serializers/ci/pipeline_entity.rb b/app/serializers/ci/pipeline_entity.rb index 5e6ae0986df..28baa64bc7c 100644 --- a/app/serializers/ci/pipeline_entity.rb +++ b/app/serializers/ci/pipeline_entity.rb @@ -42,7 +42,6 @@ class Ci::PipelineEntity < Grape::Entity expose :duration expose :finished_at expose :event_type_name - expose :event_type_name, as: :name # To be removed in 15.7 end expose :merge_request, if: -> (*) { has_presentable_merge_request? }, with: MergeRequestForPipelineEntity do |pipeline| diff --git a/app/serializers/merge_requests/pipeline_entity.rb b/app/serializers/merge_requests/pipeline_entity.rb index cf050b32d21..500dc435526 100644 --- a/app/serializers/merge_requests/pipeline_entity.rb +++ b/app/serializers/merge_requests/pipeline_entity.rb @@ -22,10 +22,6 @@ class MergeRequests::PipelineEntity < Grape::Entity pipeline.present.event_type_name end - expose :name do |pipeline| # To be removed in 15.7 - pipeline.present.event_type_name - end - expose :artifacts do |pipeline, options| rel = pipeline.downloadable_artifacts diff --git a/app/services/ci/job_token_scope/remove_project_service.rb b/app/services/ci/job_token_scope/remove_project_service.rb index 15644e529d9..d21eff2b619 100644 --- a/app/services/ci/job_token_scope/remove_project_service.rb +++ b/app/services/ci/job_token_scope/remove_project_service.rb @@ -5,14 +5,16 @@ module Ci class RemoveProjectService < ::BaseService include EditScopeValidations - def execute(target_project) + def execute(target_project, direction: :outbound) validate_edit!(project, target_project, current_user) if project == target_project return ServiceResponse.error(message: "Source project cannot be removed from the job token scope") end - link = ::Ci::JobToken::ProjectScopeLink.for_source_and_target(project, target_project) + link = ::Ci::JobToken::ProjectScopeLink + .with_access_direction(direction) + .for_source_and_target(project, target_project) unless link return ServiceResponse.error(message: "Target project is not in the job token scope") diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index 064bf132d3d..ad2ade19f2b 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -177,19 +177,17 @@ module Users # Allowed params for user signup def signup_params - signup_params = [ + [ :email, :name, :password, :password_automatically_set, + :preferred_language, :username, :user_type, :first_name, :last_name ] - signup_params << :preferred_language if ::Feature.enabled?(:preferred_language_switcher) - - signup_params end end end diff --git a/app/views/devise/shared/_language_switcher.html.haml b/app/views/devise/shared/_language_switcher.html.haml index 4c47e3efd0f..9dc9a940149 100644 --- a/app/views/devise/shared/_language_switcher.html.haml +++ b/app/views/devise/shared/_language_switcher.html.haml @@ -1,3 +1 @@ -- return unless ::Feature.enabled?(:preferred_language_switcher) - .js-language-switcher{ data: { locales: ordered_selectable_locales.to_json } } diff --git a/app/workers/bulk_imports/pipeline_worker.rb b/app/workers/bulk_imports/pipeline_worker.rb index 7435a1f6a88..8f03c74e13e 100644 --- a/app/workers/bulk_imports/pipeline_worker.rb +++ b/app/workers/bulk_imports/pipeline_worker.rb @@ -42,6 +42,7 @@ module BulkImports def run return skip_tracker if entity.failed? + raise(Pipeline::ExpiredError, 'Pipeline timeout') if job_timeout? raise(Pipeline::FailedError, "Export from source instance failed: #{export_status.error}") if export_failed? raise(Pipeline::ExpiredError, 'Empty export status on source instance') if empty_export_timeout? @@ -171,5 +172,11 @@ module BulkImports def lease_key "gitlab:bulk_imports:pipeline_worker:#{pipeline_tracker.id}" end + + def job_timeout? + return false unless file_extraction_pipeline? + + time_since_tracker_created > Pipeline::NDJSON_EXPORT_TIMEOUT + end end end diff --git a/config/feature_flags/development/preferred_language_switcher.yml b/config/feature_flags/development/preferred_language_switcher.yml deleted file mode 100644 index 9dedb1421aa..00000000000 --- a/config/feature_flags/development/preferred_language_switcher.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: preferred_language_switcher -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101621 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/381181 -milestone: '15.6' -type: development -default_enabled: false diff --git a/config/routes/import.rb b/config/routes/import.rb index b319e6ca223..2513cd04cfb 100644 --- a/config/routes/import.rb +++ b/config/routes/import.rb @@ -22,6 +22,7 @@ namespace :import do get :callback get :realtime_changes post :cancel + post :cancel_all end resource :gitea, only: [:create, :new], controller: :gitea do diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index d9e07d45355..3e1c91040c9 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1204,6 +1204,7 @@ Input type: `CiJobTokenScopeRemoveProjectInput` | Name | Type | Description | | ---- | ---- | ----------- | | `clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | +| `direction` | [`CiJobTokenScopeDirection`](#cijobtokenscopedirection) | Direction of access, which defaults to outbound. | | `projectPath` | [`ID!`](#id) | Project that the CI job token scope belongs to. | | `targetProjectPath` | [`ID!`](#id) | Project to be removed from the CI job token scope. | diff --git a/doc/integration/security_partners/index.md b/doc/integration/security_partners/index.md index a337ed7757b..276315b9adf 100644 --- a/doc/integration/security_partners/index.md +++ b/doc/integration/security_partners/index.md @@ -25,5 +25,6 @@ each security partner: - [Tenable](https://docs.tenable.com/tenableio/Content/ContainerSecurity/GetStarted.htm) - [Venafi](https://marketplace.venafi.com/details/gitlab-ci-cd/) - [Veracode](https://community.veracode.com/s/knowledgeitem/gitlab-ci-MCEKSYPRWL35BRTGOVI55SK5RI4A) +- [Fortify](https://www.microfocus.com/en-us/fortify-integrations/gitlab) diff --git a/doc/user/group/contribution_analytics/index.md b/doc/user/group/contribution_analytics/index.md index ddf468e39b0..55345a0b865 100644 --- a/doc/user/group/contribution_analytics/index.md +++ b/doc/user/group/contribution_analytics/index.md @@ -22,31 +22,25 @@ To view Contribution Analytics: 1. On the top bar, select **Main menu > Groups** and find your group. 1. On the left sidebar, select **Analytics > Contribution**. -## Using Contribution Analytics - Three bar graphs illustrate the number of contributions made by each group member: - Push events - Merge requests - Closed issues +### View a member's contributions + Hover over each bar to display the number of events for a specific group member. ![Contribution analytics bar graphs](img/group_stats_graph.png) -## Changing the period time +### Zoom in on a chart -You can choose from the following three periods: +You can zoom in on a bar chart to display only a subset of group members. -- Last week (default) -- Last month -- Last three months +To do this, select the sliders (**{status-paused}**) below the chart and slide them along the axis. -Select the desired period from the calendar dropdown list. - -![Contribution analytics choose period](img/group_stats_cal.png) - -## Sorting by different factors +### Sort contributions Contributions per group member are also presented in tabular format. Select a column header to sort the table by that column: @@ -61,6 +55,18 @@ Contributions per group member are also presented in tabular format. Select a co ![Contribution analytics contributions table](img/group_stats_table.png) +## Change the time period + +You can choose from the following three periods: + +- Last week (default) +- Last month +- Last three months + +Select the desired period from the calendar dropdown list. + +![Contribution analytics choose period](img/group_stats_cal.png) + ## Contribution analytics GraphQL API To retrieve metrics for user contributions, use the [GraphQL](../../../api/graphql/reference/index.md#groupcontributions) API. diff --git a/doc/user/group/import/index.md b/doc/user/group/import/index.md index e23458249f2..6a24a00de67 100644 --- a/doc/user/group/import/index.md +++ b/doc/user/group/import/index.md @@ -79,6 +79,7 @@ To migrate groups by direct transfer: - Both GitLab instances must have group migration by direct transfer [enabled in application settings](../../admin_area/settings/visibility_and_access_controls.md#enable-migration-of-groups-and-projects-by-direct-transfer) by an instance administrator. +- The source GitLab instance must be running GitLab 14.0 or later. - You must have the Owner role on the source group to migrate from. - You must have at least the Maintainer role on the destination group to migrate to. Using the Developer role for this purpose was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/387891) in GitLab 15.8 and will be removed in @@ -100,16 +101,16 @@ To ensure GitLab maps users and their contributions correctly: [SAML SSO for GitLab.com groups](../../group/saml_sso/index.md), users must [link their SAML identity to their GitLab.com account](../../group/saml_sso/index.md#linking-saml-to-your-existing-gitlabcom-account). -### Connect to the source GitLab instance +### Connect the source GitLab instance -Create the group you want to import to and connect the source: +Create the group you want to import to and connect the source GitLab instance: 1. Create either: - A new group. On the top bar, select **{plus-square}**, then **New group**, and select **Import group**. - A new subgroup. On existing group's page, either: - Select **New subgroup**. - On the top bar, Select **{plus-square}** and then **New subgroup**. Then on the left sidebar, select the **import an existing group** link. -1. Enter the URL of your source GitLab instance. +1. Enter the URL of a GitLab instance running GitLab 14.0 or later. 1. Generate or copy a [personal access token](../../../user/profile/personal_access_tokens.md) on your source GitLab instance with: - The `api` scope, if the source GitLab instance on version 15.1 or later. diff --git a/lib/bulk_imports/pipeline.rb b/lib/bulk_imports/pipeline.rb index e65232a5734..681d6e9aad6 100644 --- a/lib/bulk_imports/pipeline.rb +++ b/lib/bulk_imports/pipeline.rb @@ -12,6 +12,7 @@ module BulkImports FailedError = Class.new(StandardError) CACHE_KEY_EXPIRATION = 2.hours + NDJSON_EXPORT_TIMEOUT = 90.minutes EMPTY_EXPORT_STATUS_TIMEOUT = 5.minutes def initialize(context) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index f267026ea44..94c063be564 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -34463,6 +34463,9 @@ msgstr "" msgid "ProtectedEnvironments|Approval rules" msgstr "" +msgid "ProtectedEnvironments|Delete deployment rule" +msgstr "" + msgid "ProtectedEnvironments|List of protected environments (%{protectedEnvironmentsCount})" msgstr "" diff --git a/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json b/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json index 01c6563f76a..7d96b5faea3 100644 --- a/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json +++ b/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json @@ -329,9 +329,6 @@ "match": "regex", "regex": "^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d(:?[0-5]\\d)?|Z)$" }, - "$.body.pipelines[*].details.name": { - "match": "type" - }, "$.body.pipelines[*].details.manual_actions": { "min": 1 }, diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 9984e989640..406a3604b23 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Import::GithubController, feature_category: :import do +RSpec.describe Import::GithubController, feature_category: :importers do include ImportSpecHelper let(:provider) { :github } @@ -419,4 +419,56 @@ RSpec.describe Import::GithubController, feature_category: :import do end end end + + describe 'POST cancel_all' do + context 'when import is in progress' do + it 'returns success' do + project = create(:project, :import_scheduled, namespace: user.namespace, import_type: 'github', import_url: 'https://fake.url') + project2 = create(:project, :import_started, namespace: user.namespace, import_type: 'github', import_url: 'https://fake2.url') + + expect(Import::Github::CancelProjectImportService) + .to receive(:new).with(project, user) + .and_return(double(execute: { status: :success, project: project })) + + expect(Import::Github::CancelProjectImportService) + .to receive(:new).with(project2, user) + .and_return(double(execute: { status: :bad_request, message: 'The import cannot be canceled because it is finished' })) + + post :cancel_all + + expect(json_response).to eq([ + { + 'id' => project.id, + 'status' => 'success' + }, + { + 'id' => project2.id, + 'status' => 'bad_request', + 'error' => 'The import cannot be canceled because it is finished' + } + ]) + end + end + + context 'when there is no imports in progress' do + it 'returns an empty array' do + create(:project, :import_finished, namespace: user.namespace, import_type: 'github', import_url: 'https://fake.url') + + post :cancel_all + + expect(json_response).to eq([]) + end + end + + context 'when there is no projects created by user' do + it 'returns an empty array' do + other_user_project = create(:project, :import_started, import_type: 'github', import_url: 'https://fake.url') + + post :cancel_all + + expect(json_response).to eq([]) + expect(other_user_project.import_status).to eq('started') + end + end + end end diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 55a73796d9d..b217b100349 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RegistrationsController, feature_category: :users do +RSpec.describe RegistrationsController, feature_category: :user_profile do include TermsHelper include FullNameHelper diff --git a/spec/features/merge_request/user_can_see_draft_toggle_spec.rb b/spec/features/merge_request/user_can_see_draft_toggle_spec.rb index 0282c954225..ac7b5cdab04 100644 --- a/spec/features/merge_request/user_can_see_draft_toggle_spec.rb +++ b/spec/features/merge_request/user_can_see_draft_toggle_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Merge request > User sees draft toggle', feature_category: :code_review do +RSpec.describe 'Merge request > User sees draft toggle', feature_category: :code_review_workflow do let_it_be(:project) { create(:project, :public, :repository) } let(:user) { project.creator } diff --git a/spec/features/projects/issues/email_participants_spec.rb b/spec/features/projects/issues/email_participants_spec.rb index fdfd926b763..753c4ea18c5 100644 --- a/spec/features/projects/issues/email_participants_spec.rb +++ b/spec/features/projects/issues/email_participants_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'viewing an issue', :js, feature_category: :issue_email_participants do +RSpec.describe 'viewing an issue', :js, feature_category: :service_desk do let_it_be(:user) { create(:user) } let_it_be(:non_member) { create(:user) } let_it_be(:project) { create(:project, :public) } diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index f2c575231ad..06e48bc82c0 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > Create Snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > Create Snippet', :js, feature_category: :source_code_management do include DropzoneHelper include Spec::Support::Helpers::Features::SnippetSpecHelpers diff --git a/spec/features/projects/snippets/show_spec.rb b/spec/features/projects/snippets/show_spec.rb index 1a480696b4e..12018b4b9d7 100644 --- a/spec/features/projects/snippets/show_spec.rb +++ b/spec/features/projects/snippets/show_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > Project snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > Project snippet', :js, feature_category: :source_code_management do let_it_be(:user) { create(:user) } let_it_be(:project) do create(:project, creator: user).tap do |p| diff --git a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb index 556f549f86c..a153298da8e 100644 --- a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb +++ b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User comments on a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User comments on a snippet', :js, feature_category: :source_code_management do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let_it_be(:snippet) { create(:project_snippet, :repository, project: project, author: user) } diff --git a/spec/features/projects/snippets/user_deletes_snippet_spec.rb b/spec/features/projects/snippets/user_deletes_snippet_spec.rb index c9d1afb7a4e..6a825fe18de 100644 --- a/spec/features/projects/snippets/user_deletes_snippet_spec.rb +++ b/spec/features/projects/snippets/user_deletes_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User deletes a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User deletes a snippet', :js, feature_category: :source_code_management do let(:project) { create(:project) } let!(:snippet) { create(:project_snippet, :repository, project: project, author: user) } let(:user) { create(:user) } diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb index 205db6c08b1..014bf63c696 100644 --- a/spec/features/projects/snippets/user_updates_snippet_spec.rb +++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User updates a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User updates a snippet', :js, feature_category: :source_code_management do include Spec::Support::Helpers::Features::SnippetSpecHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/snippets/user_views_snippets_spec.rb b/spec/features/projects/snippets/user_views_snippets_spec.rb index ece65763ea5..a6d1db2b02f 100644 --- a/spec/features/projects/snippets/user_views_snippets_spec.rb +++ b/spec/features/projects/snippets/user_views_snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User views snippets', feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User views snippets', feature_category: :source_code_management do let_it_be(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/features/snippets_spec.rb b/spec/features/snippets_spec.rb index 2ccdb68e844..dde2f0fcfaa 100644 --- a/spec/features/snippets_spec.rb +++ b/spec/features/snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Snippets', feature_category: :snippets do +RSpec.describe 'Snippets', feature_category: :source_code_management do context 'when the project has snippets' do let(:project) { create(:project, :public) } let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) } diff --git a/spec/features/users/snippets_spec.rb b/spec/features/users/snippets_spec.rb index 0d6bb0823b6..2876351be37 100644 --- a/spec/features/users/snippets_spec.rb +++ b/spec/features/users/snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Snippets tab on a user profile', :js, feature_category: :snippets do +RSpec.describe 'Snippets tab on a user profile', :js, feature_category: :source_code_management do context 'when the user has snippets' do let(:user) { create(:user) } diff --git a/spec/frontend/pipelines/mock_data.js b/spec/frontend/pipelines/mock_data.js index 36bce65dd56..dd7e81f3f22 100644 --- a/spec/frontend/pipelines/mock_data.js +++ b/spec/frontend/pipelines/mock_data.js @@ -837,7 +837,6 @@ export const mockPipelineTag = () => { duration: 93, finished_at: '2022-02-02T15:40:59.384Z', event_type_name: 'Pipeline', - name: 'Pipeline', manual_actions: [], scheduled_actions: [], }, @@ -1045,7 +1044,6 @@ export const mockPipelineBranch = () => { duration: 75, finished_at: '2022-01-14T18:02:35.842Z', event_type_name: 'Pipeline', - name: 'Pipeline', manual_actions: [], scheduled_actions: [], }, diff --git a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js index 9c348fc9d58..441054493f7 100644 --- a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js @@ -224,7 +224,6 @@ describe('MRWidgetPipeline', () => { ({ pipeline } = JSON.parse(JSON.stringify(mockData))); pipeline.details.event_type_name = 'Pipeline'; - pipeline.details.name = 'Pipeline'; pipeline.merge_request_event_type = undefined; pipeline.ref.tag = false; pipeline.ref.branch = false; @@ -266,7 +265,6 @@ describe('MRWidgetPipeline', () => { describe('for a detached merge request pipeline', () => { it('renders a pipeline widget that reads "Merge request pipeline for "', () => { pipeline.details.event_type_name = 'Merge request pipeline'; - pipeline.details.name = 'Merge request pipeline'; pipeline.merge_request_event_type = 'detached'; factory(); diff --git a/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb b/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb index 4a0501bddbd..7fb45e93474 100644 --- a/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb +++ b/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Mutations::Ci::JobTokenScope::RemoveProject, feature_category: :c end let(:target_project_path) { target_project.full_path } + let(:links_relation) { Ci::JobToken::ProjectScopeLink.with_source(project).with_target(target_project) } subject do mutation.resolve(project_path: project.full_path, target_project_path: target_project_path) @@ -45,18 +46,39 @@ RSpec.describe Mutations::Ci::JobTokenScope::RemoveProject, feature_category: :c target_project.add_guest(current_user) end - it 'removes target project from the job token scope' do - expect do - expect(subject).to include(ci_job_token_scope: be_present, errors: be_empty) - end.to change { Ci::JobToken::ProjectScopeLink.count }.by(-1) + context 'with no direction specified' do + it 'defaults to removing an outbound link to the target project' do + expect do + expect(subject).to include(ci_job_token_scope: be_present, errors: be_empty) + end.to change { Ci::JobToken::ProjectScopeLink.count }.by(-1) + + expect(links_relation.outbound.reload).to be_empty + end + end + + context 'with direction specified' do + let(:service) { instance_double('Ci::JobTokenScope::RemoveProjectService') } + + subject do + mutation.resolve(project_path: project.full_path, target_project_path: target_project_path, direction: 'inbound') + end + + it 'executes project removal for the correct direction' do + expect(::Ci::JobTokenScope::RemoveProjectService) + .to receive(:new).with(project, current_user).and_return(service) + expect(service).to receive(:execute).with(target_project, direction: 'inbound') + .and_return(instance_double('ServiceResponse', "success?": true)) + + subject + end end context 'when the service returns an error' do - let(:service) { double(:service) } + let(:service) { instance_double('Ci::JobTokenScope::RemoveProjectService') } it 'returns an error response' do expect(::Ci::JobTokenScope::RemoveProjectService).to receive(:new).with(project, current_user).and_return(service) - expect(service).to receive(:execute).with(target_project).and_return(ServiceResponse.error(message: 'The error message')) + expect(service).to receive(:execute).with(target_project, direction: :outbound).and_return(ServiceResponse.error(message: 'The error message')) expect(subject.fetch(:ci_job_token_scope)).to be_nil expect(subject.fetch(:errors)).to include("The error message") diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index a0680830622..1ae834c0769 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -98,7 +98,7 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do end end - describe '#assigned_issuables_count', feature_category: :project_management do + describe '#assigned_issuables_count', feature_category: :team_planning do context 'when issuable is issues' do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project).tap { |p| p.add_developer(user) } } @@ -117,7 +117,7 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do end end - describe '#assigned_open_issues_count_text', feature_category: :project_management do + describe '#assigned_open_issues_count_text', feature_category: :team_planning do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project).tap { |p| p.add_developer(user) } } diff --git a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb index 35ca67c8a4c..d6622785e65 100644 --- a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb +++ b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline, feature_category: :import do +RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:group) { create(:group) } diff --git a/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb b/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb index 97b432406eb..1365adb8993 100644 --- a/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb +++ b/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Database::Migrations::BatchedMigrationLastId, feature_category: :pipeline_insights do +RSpec.describe Gitlab::Database::Migrations::BatchedMigrationLastId, feature_category: :database do subject(:test_sampling) { described_class.new(connection, base_dir) } let(:base_dir) { Pathname.new(Dir.mktmpdir) } diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb index 1b8da0b380b..c5b44b260c6 100644 --- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb +++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require 'json' require 'tempfile' -RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitlay do +RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do let(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:feature_flag_name) { wrapper.rugged_feature_keys.first } diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb index d69bc4d60ee..e93d585bc3c 100644 --- a/spec/lib/gitlab/github_import/client_spec.rb +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Client, feature_category: :importer do +RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do subject(:client) { described_class.new('foo', parallel: parallel) } let(:parallel) { true } diff --git a/spec/lib/gitlab/github_import/clients/proxy_spec.rb b/spec/lib/gitlab/github_import/clients/proxy_spec.rb index 9fef57f2a38..0baff7bafcb 100644 --- a/spec/lib/gitlab/github_import/clients/proxy_spec.rb +++ b/spec/lib/gitlab/github_import/clients/proxy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Clients::Proxy, :manage, feature_category: :import do +RSpec.describe Gitlab::GithubImport::Clients::Proxy, :manage, feature_category: :importers do subject(:client) { described_class.new(access_token, client_options) } let(:access_token) { 'test_token' } diff --git a/spec/lib/gitlab/import_export/version_checker_spec.rb b/spec/lib/gitlab/import_export/version_checker_spec.rb index b3730d85f13..dd81b8b846d 100644 --- a/spec/lib/gitlab/import_export/version_checker_spec.rb +++ b/spec/lib/gitlab/import_export/version_checker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::ImportExport::VersionChecker, feature_category: :import do +RSpec.describe Gitlab::ImportExport::VersionChecker, feature_category: :importers do include ImportExport::CommonUtil let!(:shared) { Gitlab::ImportExport::Shared.new(nil) } diff --git a/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb b/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb index a57d3633ecf..c0b94313d4d 100644 --- a/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb +++ b/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveLeftoverExternalPullRequestDeletions, feature_category: :sharding do +RSpec.describe RemoveLeftoverExternalPullRequestDeletions, feature_category: :pods do let(:deleted_records) { table(:loose_foreign_keys_deleted_records) } let(:pending_record1) { deleted_records.create!(id: 1, fully_qualified_table_name: 'public.external_pull_requests', primary_key_value: 1, status: 1) } diff --git a/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb b/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb index 555856788b7..e9bca42f37f 100644 --- a/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb +++ b/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveLeftoverCiJobArtifactDeletions, feature_category: :sharding do +RSpec.describe RemoveLeftoverCiJobArtifactDeletions, feature_category: :pods do let(:deleted_records) { table(:loose_foreign_keys_deleted_records) } target_table_name = Ci::JobArtifact.table_name diff --git a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb index dd77ce503b8..36c65612bb9 100644 --- a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb +++ b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :utilization do +RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :subscription_cost_management do let!(:users) { table(:users) } let!(:user_highest_roles) { table(:user_highest_roles) } diff --git a/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb b/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb index 899074399a1..d8270816afe 100644 --- a/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb +++ b/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe UpdateImportSourcesOnApplicationSettings, feature_category: :migration do +RSpec.describe UpdateImportSourcesOnApplicationSettings, feature_category: :importers do let(:settings) { table(:application_settings) } let(:import_sources_with_google) { %w[google_code github git bitbucket bitbucket_server] } let(:import_sources_without_google) { %w[github git bitbucket bitbucket_server] } diff --git a/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb b/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb index e5b20b2d48a..1f276109b24 100644 --- a/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb +++ b/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe FixUpdateImportSourcesOnApplicationSettings, feature_category: :migration do +RSpec.describe FixUpdateImportSourcesOnApplicationSettings, feature_category: :importers do let(:settings) { table(:application_settings) } let(:import_sources) { %w[github git bitbucket bitbucket_server] } diff --git a/spec/models/integrations/apple_app_store_spec.rb b/spec/models/integrations/apple_app_store_spec.rb index 1a57f556895..e35daa4ae77 100644 --- a/spec/models/integrations/apple_app_store_spec.rb +++ b/spec/models/integrations/apple_app_store_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Integrations::AppleAppStore, feature_category: :mobile_devops do +RSpec.describe Integrations::AppleAppStore, feature_category: :mobile_signing_deployment do describe 'Validations' do context 'when active' do before do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 3a42d5d4c3f..e29318a7e83 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issue, feature_category: :project_management do +RSpec.describe Issue, feature_category: :team_planning do include ExternalAuthorizationServiceHelpers using RSpec::Parameterized::TableSyntax diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 4988ba3b70b..b438984322d 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -8813,6 +8813,16 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do end end + describe '.is_importing' do + it 'returns projects that have import in progress' do + project_1 = create(:project, :import_scheduled, import_type: 'github') + project_2 = create(:project, :import_started, import_type: 'github') + create(:project, :import_finished, import_type: 'github') + + expect(described_class.is_importing).to match_array([project_1, project_2]) + end + end + private def finish_job(export_job) diff --git a/spec/models/resource_event_spec.rb b/spec/models/resource_event_spec.rb index f40c192ab2b..62bd5314b69 100644 --- a/spec/models/resource_event_spec.rb +++ b/spec/models/resource_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceEvent, feature_category: :team_planning, type: :model do let(:dummy_resource_label_event_class) do Class.new(ResourceEvent) do self.table_name = 'resource_label_events' diff --git a/spec/models/resource_label_event_spec.rb b/spec/models/resource_label_event_spec.rb index 87f3b9fb2bb..eb28010d57f 100644 --- a/spec/models/resource_label_event_spec.rb +++ b/spec/models/resource_label_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceLabelEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceLabelEvent, feature_category: :team_planning, type: :model do let_it_be(:project) { create(:project, :repository) } let_it_be(:issue) { create(:issue, project: project) } let_it_be(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/models/resource_milestone_event_spec.rb b/spec/models/resource_milestone_event_spec.rb index 11b704ceadf..d237a16da8f 100644 --- a/spec/models/resource_milestone_event_spec.rb +++ b/spec/models/resource_milestone_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceMilestoneEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceMilestoneEvent, feature_category: :team_planning, type: :model do it_behaves_like 'a resource event' it_behaves_like 'a resource event for issues' it_behaves_like 'a resource event for merge requests' diff --git a/spec/models/resource_state_event_spec.rb b/spec/models/resource_state_event_spec.rb index 04e4359a3ff..a6d6b507b69 100644 --- a/spec/models/resource_state_event_spec.rb +++ b/spec/models/resource_state_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceStateEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceStateEvent, feature_category: :team_planning, type: :model do subject { build(:resource_state_event, issue: issue) } let(:issue) { create(:issue) } diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb index 7120975a420..0575ba3237b 100644 --- a/spec/policies/global_policy_spec.rb +++ b/spec/policies/global_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GlobalPolicy, feature_category: :security_policies do +RSpec.describe GlobalPolicy, feature_category: :shared do include TermsHelper let_it_be(:admin_user) { create(:admin) } diff --git a/spec/policies/todo_policy_spec.rb b/spec/policies/todo_policy_spec.rb index fa62f53c628..0230f106f0f 100644 --- a/spec/policies/todo_policy_spec.rb +++ b/spec/policies/todo_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodoPolicy, feature_category: :project_management do +RSpec.describe TodoPolicy, feature_category: :team_planning do using RSpec::Parameterized::TableSyntax let_it_be(:project) { create(:project) } diff --git a/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb b/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb index 61d5c56ae8a..805f300072d 100644 --- a/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb @@ -22,6 +22,7 @@ RSpec.describe 'CiJobTokenScopeRemoveProject', feature_category: :continuous_int let(:variables) do { + direction: 'OUTBOUND', project_path: project.full_path, target_project_path: target_project.full_path } @@ -67,7 +68,7 @@ RSpec.describe 'CiJobTokenScopeRemoveProject', feature_category: :continuous_int target_project.add_guest(current_user) end - it 'removes the target project from the job token scope' do + it 'removes the target project from the job token outbound scope' do expect do post_graphql_mutation(mutation, current_user: current_user) expect(response).to have_gitlab_http_status(:success) diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb index e34066d0ee4..4c0635c8640 100644 --- a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'PipelineSchedulePlay', feature_category: :continuious_integration do +RSpec.describe 'PipelineSchedulePlay', feature_category: :continuous_integration do include GraphqlHelpers let_it_be(:user) { create(:user) } diff --git a/spec/requests/api/graphql/project/project_statistics_spec.rb b/spec/requests/api/graphql/project/project_statistics_spec.rb index d078659b954..444738cbc81 100644 --- a/spec/requests/api/graphql/project/project_statistics_spec.rb +++ b/spec/requests/api/graphql/project/project_statistics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'rendering project statistics', feature_category: :project_statistics do +RSpec.describe 'rendering project statistics', feature_category: :shared do include GraphqlHelpers let(:project) { create(:project) } diff --git a/spec/routing/import_routing_spec.rb b/spec/routing/import_routing_spec.rb index b63ae1e7e4e..ac3f2a4b7ca 100644 --- a/spec/routing/import_routing_spec.rb +++ b/spec/routing/import_routing_spec.rb @@ -71,6 +71,10 @@ RSpec.describe Import::GithubController, 'routing' do it 'to #personal_access_token' do expect(post('/import/github/personal_access_token')).to route_to('import/github#personal_access_token') end + + it 'to #cancel_all' do + expect(post('/import/github/cancel_all')).to route_to('import/github#cancel_all') + end end # personal_access_token_import_gitea POST /import/gitea/personal_access_token(.:format) import/gitea#personal_access_token diff --git a/spec/serializers/ci/pipeline_entity_spec.rb b/spec/serializers/ci/pipeline_entity_spec.rb index ae992e478a6..4df542e3c98 100644 --- a/spec/serializers/ci/pipeline_entity_spec.rb +++ b/spec/serializers/ci/pipeline_entity_spec.rb @@ -36,11 +36,10 @@ RSpec.describe Ci::PipelineEntity do expect(subject).to include :details expect(subject[:details]) - .to include :duration, :finished_at, :name, :event_type_name + .to include :duration, :finished_at, :event_type_name expect(subject[:details][:status]).to include :icon, :favicon, :text, :label, :tooltip expect(subject[:details][:event_type_name]).to eq('Merged result pipeline') - expect(subject[:details][:name]).to eq('Merged result pipeline') end it 'contains flags' do diff --git a/spec/serializers/merge_requests/pipeline_entity_spec.rb b/spec/serializers/merge_requests/pipeline_entity_spec.rb index 414ce6653bc..acffa1e87a6 100644 --- a/spec/serializers/merge_requests/pipeline_entity_spec.rb +++ b/spec/serializers/merge_requests/pipeline_entity_spec.rb @@ -33,12 +33,11 @@ RSpec.describe MergeRequests::PipelineEntity do ) expect(subject[:commit]).to include(:short_id, :commit_path) expect(subject[:ref]).to include(:branch) - expect(subject[:details]).to include(:artifacts, :name, :event_type_name, :status, :stages, :finished_at) + expect(subject[:details]).to include(:artifacts, :event_type_name, :status, :stages, :finished_at) expect(subject[:details][:status]).to include(:icon, :favicon, :text, :label, :tooltip) expect(subject[:flags]).to include(:merge_request_pipeline) expect(subject[:details][:event_type_name]).to eq('Merged result pipeline') - expect(subject[:details][:name]).to eq('Merged result pipeline') end it 'returns presented coverage' do diff --git a/spec/services/lfs/file_transformer_spec.rb b/spec/services/lfs/file_transformer_spec.rb index 9d4d8851c2d..c90d7af022f 100644 --- a/spec/services/lfs/file_transformer_spec.rb +++ b/spec/services/lfs/file_transformer_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe Lfs::FileTransformer, feature_category: :git_lfs do +RSpec.describe Lfs::FileTransformer, feature_category: :source_code_management do let(:project) { create(:project, :repository, :wiki_repo) } let(:repository) { project.repository } let(:file_content) { 'Test file content' } diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index 8c90946e09e..1ee9e51433e 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -512,7 +512,7 @@ RSpec.describe Notes::CreateService, feature_category: :team_planning do end end - context 'personal snippet note', feature_category: :snippets do + context 'personal snippet note', feature_category: :source_code_management do subject { described_class.new(nil, user, params).execute } let(:snippet) { create(:personal_snippet) } diff --git a/spec/services/security/ci_configuration/sast_create_service_spec.rb b/spec/services/security/ci_configuration/sast_create_service_spec.rb index 39c32567f3c..e80fe1a42fa 100644 --- a/spec/services/security/ci_configuration/sast_create_service_spec.rb +++ b/spec/services/security/ci_configuration/sast_create_service_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow, feature_category: :sast do +RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow, + feature_category: :static_application_security_testing do subject(:result) { described_class.new(project, user, params).execute } let(:branch_name) { 'set-sast-config-1' } diff --git a/spec/services/users/assigned_issues_count_service_spec.rb b/spec/services/users/assigned_issues_count_service_spec.rb index afa6a0af3dd..2062f68b24b 100644 --- a/spec/services/users/assigned_issues_count_service_spec.rb +++ b/spec/services/users/assigned_issues_count_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Users::AssignedIssuesCountService, :use_clean_rails_memory_store_caching, - feature_category: :project_management do + feature_category: :team_planning do let_it_be(:user) { create(:user) } let_it_be(:max_limit) { 10 } diff --git a/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb b/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb index 85f71da8c97..25ea5d75a56 100644 --- a/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb +++ b/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb @@ -7,7 +7,7 @@ require 'rake_helper' # is hit in the rake task. require 'git' -RSpec.describe 'gitlab:security namespace rake tasks', :silence_stdout, feature_category: :security do +RSpec.describe 'gitlab:security namespace rake tasks', :silence_stdout, feature_category: :credential_management do let(:fixture_path) { Rails.root.join('spec/fixtures/tasks/gitlab/security') } let(:output_file) { File.join(__dir__, 'tmp/banned_keys_test.yml') } let(:git_url) { 'https://github.com/rapid7/ssh-badkeys.git' } diff --git a/spec/views/layouts/snippets.html.haml_spec.rb b/spec/views/layouts/snippets.html.haml_spec.rb index 69378906bcd..5c182f715d6 100644 --- a/spec/views/layouts/snippets.html.haml_spec.rb +++ b/spec/views/layouts/snippets.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'layouts/snippets', feature_category: :snippets do +RSpec.describe 'layouts/snippets', feature_category: :source_code_management do before do allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user)) diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index 52b3d5b95f9..5fe89102be3 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code do +RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code_management do let(:project) { create(:project, :repository) } let(:commit) { project.commit } diff --git a/spec/workers/bulk_imports/pipeline_worker_spec.rb b/spec/workers/bulk_imports/pipeline_worker_spec.rb index 10c63606f81..e8b0714471d 100644 --- a/spec/workers/bulk_imports/pipeline_worker_spec.rb +++ b/spec/workers/bulk_imports/pipeline_worker_spec.rb @@ -507,6 +507,40 @@ RSpec.describe BulkImports::PipelineWorker, feature_category: :importers do end end + context 'when job reaches timeout' do + it 'marks as failed and logs the error' do + old_created_at = pipeline_tracker.created_at + pipeline_tracker.update!(created_at: (BulkImports::Pipeline::NDJSON_EXPORT_TIMEOUT + 1.hour).ago) + + expect_next_instance_of(Gitlab::Import::Logger) do |logger| + expect(logger) + .to receive(:error) + .with( + hash_including( + 'pipeline_name' => 'NdjsonPipeline', + 'bulk_import_entity_id' => entity.id, + 'bulk_import_id' => entity.bulk_import_id, + 'bulk_import_entity_type' => entity.source_type, + 'source_full_path' => entity.source_full_path, + 'class' => 'BulkImports::PipelineWorker', + 'exception.backtrace' => anything, + 'exception.class' => 'BulkImports::Pipeline::ExpiredError', + 'exception.message' => 'Pipeline timeout', + 'importer' => 'gitlab_migration', + 'message' => 'Pipeline failed', + 'source_version' => entity.bulk_import.source_version_info.to_s + ) + ) + end + + subject.perform(pipeline_tracker.id, pipeline_tracker.stage, entity.id) + + expect(pipeline_tracker.reload.status_name).to eq(:failed) + + entity.update!(created_at: old_created_at) + end + end + context 'when export status is failed' do it 'marks as failed and logs the error' do allow_next_instance_of(BulkImports::ExportStatus) do |status| -- cgit v1.2.1