From de5fc582771ba7e2dc6e1c783ce8ee417fbe6788 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 23 Aug 2022 21:10:34 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/finders/issuable_finder.rb | 3 +- app/graphql/types/project_type.rb | 393 ++++++++++-------- app/helpers/application_settings_helper.rb | 3 +- app/models/application_setting.rb | 4 + app/models/ci/build.rb | 4 +- app/models/ci/job_artifact.rb | 14 +- app/models/ci/pipeline.rb | 12 +- app/models/issue.rb | 10 - app/models/merge_request.rb | 12 +- .../_account_and_limit.html.haml | 1 + .../_invitation_flow_enforcement.html.haml | 8 + .../projects/pipelines/_with_tabs.html.haml | 2 +- ...> invitation_flow_enforcement_setting.yml} | 10 +- config/sidekiq_queues.yml | 2 + ...low_enforcement_to_application_settings.rb | 10 + ...te_metadata_temp_index_on_id_where_task.rb | 15 + ...k_system_note_wording_to_checklist_item.rb | 28 ++ ...oval_partial_trigram_indexes_for_issues.rb | 16 + db/schema_migrations/20220711142148 | 1 + db/schema_migrations/20220809214730 | 1 + db/schema_migrations/20220809223215 | 1 + db/schema_migrations/20220823084747 | 1 + db/structure.sql | 3 + doc/ci/pipelines/merge_request_pipelines.md | 25 ++ .../shell_scripting_guide/index.md | 2 +- doc/install/azure/index.md | 2 +- doc/install/google_cloud_platform/index.md | 2 +- doc/install/index.md | 46 +- doc/install/install_methods.md | 51 +++ doc/install/requirements.md | 33 +- lib/gitlab/auth/o_auth/provider.rb | 4 +- ...name_task_system_note_to_checklist_item.rb | 28 ++ .../ci/reports/coverage_report_generator.rb | 2 +- lib/gitlab/usage_data.rb | 4 +- lib/tasks/gitlab/tw/codeowners.rake | 2 +- locale/gitlab.pot | 6 + .../application_settings_controller_spec.rb | 11 + spec/helpers/projects/pipeline_helper_spec.rb | 2 +- spec/lib/gitlab/auth/o_auth/provider_spec.rb | 18 + ...task_system_note_to_checklist_item_spec.rb | 91 ++++ ...tem_note_wording_to_checklist_item_spec.rb | 32 ++ spec/models/ci/build_spec.rb | 14 +- spec/models/ci/job_artifact_spec.rb | 146 +++---- spec/models/ci/pipeline_spec.rb | 18 +- spec/models/issue_spec.rb | 16 - .../ci/pipelines/hook_service_spec.rb | 2 +- spec/workers/every_sidekiq_worker_spec.rb | 1 + 47 files changed, 714 insertions(+), 398 deletions(-) create mode 100644 app/views/admin/application_settings/_invitation_flow_enforcement.html.haml rename config/feature_flags/development/{report_artifact_build_completed_metrics_on_build_completion.yml => invitation_flow_enforcement_setting.yml} (55%) create mode 100644 db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb create mode 100644 db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb create mode 100644 db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb create mode 100644 db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb create mode 100644 db/schema_migrations/20220711142148 create mode 100644 db/schema_migrations/20220809214730 create mode 100644 db/schema_migrations/20220809223215 create mode 100644 db/schema_migrations/20220823084747 create mode 100644 doc/install/install_methods.md create mode 100644 lib/gitlab/background_migration/rename_task_system_note_to_checklist_item.rb create mode 100644 spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb create mode 100644 spec/migrations/change_task_system_note_wording_to_checklist_item_spec.rb diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 1088d53c9a0..47b2a460e6f 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -46,8 +46,7 @@ class IssuableFinder requires_cross_project_access unless: -> { params.project? } - FULL_TEXT_SEARCH_TERM_PATTERN = '[\u0000-\u218F]*' - FULL_TEXT_SEARCH_TERM_REGEX = /\A#{FULL_TEXT_SEARCH_TERM_PATTERN}\z/.freeze + FULL_TEXT_SEARCH_TERM_REGEX = /\A[\p{ASCII}|\p{Latin}]+\z/.freeze NEGATABLE_PARAMS_HELPER_KEYS = %i[project_id scope status include_subgroups].freeze attr_accessor :current_user, :params diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 436fec4b8ef..2ad4e8848d1 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -10,119 +10,193 @@ module Types expose_permissions Types::PermissionTypes::Project - field :id, GraphQL::Types::ID, null: false, - description: 'ID of the project.' + field :id, GraphQL::Types::ID, + null: false, + description: 'ID of the project.' - field :ci_config_path_or_default, GraphQL::Types::String, null: false, - description: 'Path of the CI configuration file.' - field :full_path, GraphQL::Types::ID, null: false, - description: 'Full path of the project.' - field :path, GraphQL::Types::String, null: false, - description: 'Path of the project.' + field :ci_config_path_or_default, GraphQL::Types::String, + null: false, + description: 'Path of the CI configuration file.' - field :sast_ci_configuration, Types::CiConfiguration::Sast::Type, null: true, - calls_gitaly: true, - description: 'SAST CI configuration for the project.' + field :full_path, GraphQL::Types::ID, + null: false, + description: 'Full path of the project.' - field :name, GraphQL::Types::String, null: false, - description: 'Name of the project (without namespace).' - field :name_with_namespace, GraphQL::Types::String, null: false, - description: 'Full name of the project with its namespace.' + field :path, GraphQL::Types::String, + null: false, + description: 'Path of the project.' - field :description, GraphQL::Types::String, null: true, - description: 'Short description of the project.' + field :sast_ci_configuration, Types::CiConfiguration::Sast::Type, + null: true, + calls_gitaly: true, + description: 'SAST CI configuration for the project.' - field :tag_list, GraphQL::Types::String, null: true, - deprecated: { reason: 'Use `topics`', milestone: '13.12' }, - description: 'List of project topics (not Git tags).', method: :topic_list + field :name, GraphQL::Types::String, + null: false, + description: 'Name of the project (without namespace).' - field :topics, [GraphQL::Types::String], null: true, - description: 'List of project topics.', method: :topic_list + field :name_with_namespace, GraphQL::Types::String, + null: false, + description: 'Full name of the project with its namespace.' - field :http_url_to_repo, GraphQL::Types::String, null: true, - description: 'URL to connect to the project via HTTPS.' - field :ssh_url_to_repo, GraphQL::Types::String, null: true, - description: 'URL to connect to the project via SSH.' - field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL of the project.' + field :description, GraphQL::Types::String, + null: true, + description: 'Short description of the project.' - field :forks_count, GraphQL::Types::Int, null: false, calls_gitaly: true, # 4 times - description: 'Number of times the project has been forked.' - field :star_count, GraphQL::Types::Int, null: false, - description: 'Number of times the project has been starred.' + field :tag_list, GraphQL::Types::String, + null: true, + deprecated: { reason: 'Use `topics`', milestone: '13.12' }, + description: 'List of project topics (not Git tags).', + method: :topic_list - field :created_at, Types::TimeType, null: true, - description: 'Timestamp of the project creation.' - field :last_activity_at, Types::TimeType, null: true, - description: 'Timestamp of the project last activity.' + field :topics, [GraphQL::Types::String], + null: true, + description: 'List of project topics.', + method: :topic_list - field :archived, GraphQL::Types::Boolean, null: true, - description: 'Indicates the archived status of the project.' + field :http_url_to_repo, GraphQL::Types::String, + null: true, + description: 'URL to connect to the project via HTTPS.' - field :visibility, GraphQL::Types::String, null: true, - description: 'Visibility of the project.' + field :ssh_url_to_repo, GraphQL::Types::String, + null: true, + description: 'URL to connect to the project via SSH.' - field :lfs_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the project has Large File Storage (LFS) enabled.' - field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' - field :shared_runners_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if shared runners are enabled for the project.' + field :web_url, GraphQL::Types::String, + null: true, + description: 'Web URL of the project.' - field :service_desk_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the project has Service Desk enabled.' + field :forks_count, GraphQL::Types::Int, + null: false, + calls_gitaly: true, # 4 times + description: 'Number of times the project has been forked.' - field :service_desk_address, GraphQL::Types::String, null: true, - description: 'E-mail address of the Service Desk.' + field :star_count, GraphQL::Types::Int, + null: false, + description: 'Number of times the project has been starred.' - field :avatar_url, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'URL to avatar image file of the project.' + field :created_at, Types::TimeType, + null: true, + description: 'Timestamp of the project creation.' - field :jobs_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' + field :last_activity_at, Types::TimeType, + null: true, + description: 'Timestamp of the project last activity.' - field :public_jobs, GraphQL::Types::Boolean, method: :public_builds, null: true, - description: 'Indicates if there is public access to pipelines and job details of the project, including output logs and artifacts.' + field :archived, GraphQL::Types::Boolean, + null: true, + description: 'Indicates the archived status of the project.' - field :open_issues_count, GraphQL::Types::Int, null: true, - description: 'Number of open issues for the project.' + field :visibility, GraphQL::Types::String, + null: true, + description: 'Visibility of the project.' - field :allow_merge_on_skipped_pipeline, GraphQL::Types::Boolean, null: true, - description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs.' - field :autoclose_referenced_issues, GraphQL::Types::Boolean, null: true, - description: 'Indicates if issues referenced by merge requests and commits within the default branch are closed automatically.' - field :import_status, GraphQL::Types::String, null: true, - description: 'Status of import background job of the project.' - field :jira_import_status, GraphQL::Types::String, null: true, - description: 'Status of Jira import background job of the project.' - field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean, null: true, - description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' - field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean, null: true, - description: 'Indicates if merge requests of the project can only be merged with successful jobs.' - field :printing_merge_request_link_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if a link to create or view a merge request should display after a push to Git repositories of the project from the command line.' - field :remove_source_branch_after_merge, GraphQL::Types::Boolean, null: true, - description: 'Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project.' - field :request_access_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if users can request member access to the project.' - field :squash_read_only, GraphQL::Types::Boolean, null: false, method: :squash_readonly?, - description: 'Indicates if `squashReadOnly` is enabled.' - field :suggestion_commit_message, GraphQL::Types::String, null: true, - description: 'Commit message used to apply merge request suggestions.' + field :lfs_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if the project has Large File Storage (LFS) enabled.' + + field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if no merge commits should be created and all merges should instead be ' \ + 'fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' + + field :shared_runners_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if shared runners are enabled for the project.' + + field :service_desk_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if the project has Service Desk enabled.' + + field :service_desk_address, GraphQL::Types::String, + null: true, + description: 'E-mail address of the Service Desk.' + + field :avatar_url, GraphQL::Types::String, + null: true, + calls_gitaly: true, + description: 'URL to avatar image file of the project.' + + field :jobs_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' + + field :public_jobs, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if there is public access to pipelines and job details of the project, ' \ + 'including output logs and artifacts.', + method: :public_builds + + field :open_issues_count, GraphQL::Types::Int, + null: true, + description: 'Number of open issues for the project.' + + field :allow_merge_on_skipped_pipeline, GraphQL::Types::Boolean, + null: true, + description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of ' \ + 'the project can also be merged with skipped jobs.' + + field :autoclose_referenced_issues, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if issues referenced by merge requests and commits within the default branch ' \ + 'are closed automatically.' + + field :import_status, GraphQL::Types::String, + null: true, + description: 'Status of import background job of the project.' + + field :jira_import_status, GraphQL::Types::String, + null: true, + description: 'Status of Jira import background job of the project.' + + field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' + + field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if merge requests of the project can only be merged with successful jobs.' + + field :printing_merge_request_link_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if a link to create or view a merge request should display after a push to Git ' \ + 'repositories of the project from the command line.' + + field :remove_source_branch_after_merge, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if `Delete source branch` option should be enabled by default for all ' \ + 'new merge requests of the project.' + + field :request_access_enabled, GraphQL::Types::Boolean, + null: true, + description: 'Indicates if users can request member access to the project.' + + field :squash_read_only, GraphQL::Types::Boolean, + null: false, + description: 'Indicates if `squashReadOnly` is enabled.', + method: :squash_readonly? + + field :suggestion_commit_message, GraphQL::Types::String, + null: true, + description: 'Commit message used to apply merge request suggestions.' # No, the quotes are not a typo. Used to get around circular dependencies. # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536#note_871009675 - field :group, 'Types::GroupType', null: true, - description: 'Group of the project.' - field :namespace, Types::NamespaceType, null: true, - description: 'Namespace of the project.' + field :group, 'Types::GroupType', + null: true, + description: 'Group of the project.' + + field :namespace, Types::NamespaceType, + null: true, + description: 'Namespace of the project.' field :statistics, Types::ProjectStatisticsType, null: true, description: 'Statistics of the project.' - field :repository, Types::RepositoryType, null: true, - description: 'Git repository of the project.' + field :repository, Types::RepositoryType, + null: true, + description: 'Git repository of the project.' field :merge_requests, Types::MergeRequestType.connection_type, @@ -159,9 +233,10 @@ module Types extras: [:lookahead], resolver: Resolvers::IssueStatusCountsResolver - field :milestones, Types::MilestoneType.connection_type, null: true, - description: 'Milestones of the project.', - resolver: Resolvers::ProjectMilestonesResolver + field :milestones, Types::MilestoneType.connection_type, + null: true, + description: 'Milestones of the project.', + resolver: Resolvers::ProjectMilestonesResolver field :project_members, description: 'Members of the project.', @@ -213,158 +288,134 @@ module Types extras: [:lookahead], resolver: Resolvers::ProjectPipelinesResolver - field :pipeline, - Types::Ci::PipelineType, + field :pipeline, Types::Ci::PipelineType, null: true, description: 'Build pipeline of the project.', extras: [:lookahead], resolver: Resolvers::ProjectPipelineResolver - field :pipeline_counts, - Types::Ci::PipelineCountsType, + field :pipeline_counts, Types::Ci::PipelineCountsType, null: true, description: 'Build pipeline counts of the project.', resolver: Resolvers::Ci::ProjectPipelineCountsResolver - field :ci_variables, - Types::Ci::ProjectVariableType.connection_type, + field :ci_variables, Types::Ci::ProjectVariableType.connection_type, null: true, description: "List of the project's CI/CD variables.", authorize: :admin_build, method: :variables - field :ci_cd_settings, - Types::Ci::CiCdSettingType, + field :ci_cd_settings, Types::Ci::CiCdSettingType, null: true, description: 'CI/CD settings for the project.' - field :sentry_detailed_error, - Types::ErrorTracking::SentryDetailedErrorType, + field :sentry_detailed_error, Types::ErrorTracking::SentryDetailedErrorType, null: true, description: 'Detailed version of a Sentry error on the project.', resolver: Resolvers::ErrorTracking::SentryDetailedErrorResolver - field :grafana_integration, - Types::GrafanaIntegrationType, + field :grafana_integration, Types::GrafanaIntegrationType, null: true, description: 'Grafana integration details for the project.', resolver: Resolvers::Projects::GrafanaIntegrationResolver - field :snippets, - Types::SnippetType.connection_type, + field :snippets, Types::SnippetType.connection_type, null: true, description: 'Snippets of the project.', resolver: Resolvers::Projects::SnippetsResolver - field :sentry_errors, - Types::ErrorTracking::SentryErrorCollectionType, + field :sentry_errors, Types::ErrorTracking::SentryErrorCollectionType, null: true, description: 'Paginated collection of Sentry errors on the project.', resolver: Resolvers::ErrorTracking::SentryErrorCollectionResolver - field :boards, - Types::BoardType.connection_type, + field :boards, Types::BoardType.connection_type, null: true, description: 'Boards of the project.', max_page_size: 2000, resolver: Resolvers::BoardsResolver - field :recent_issue_boards, - Types::BoardType.connection_type, + field :recent_issue_boards, Types::BoardType.connection_type, null: true, description: 'List of recently visited boards of the project. Maximum size is 4.', resolver: Resolvers::RecentBoardsResolver - field :board, - Types::BoardType, + field :board, Types::BoardType, null: true, description: 'A single board of the project.', resolver: Resolvers::BoardResolver - field :jira_imports, - Types::JiraImportType.connection_type, + field :jira_imports, Types::JiraImportType.connection_type, null: true, description: 'Jira imports into the project.' - field :services, - Types::Projects::ServiceType.connection_type, + field :services, Types::Projects::ServiceType.connection_type, null: true, description: 'Project services.', resolver: Resolvers::Projects::ServicesResolver - field :alert_management_alerts, - Types::AlertManagement::AlertType.connection_type, + field :alert_management_alerts, Types::AlertManagement::AlertType.connection_type, null: true, description: 'Alert Management alerts of the project.', extras: [:lookahead], resolver: Resolvers::AlertManagement::AlertResolver - field :alert_management_alert, - Types::AlertManagement::AlertType, + field :alert_management_alert, Types::AlertManagement::AlertType, null: true, description: 'A single Alert Management alert of the project.', resolver: Resolvers::AlertManagement::AlertResolver.single - field :alert_management_alert_status_counts, - Types::AlertManagement::AlertStatusCountsType, + field :alert_management_alert_status_counts, Types::AlertManagement::AlertStatusCountsType, null: true, description: 'Counts of alerts by status for the project.', resolver: Resolvers::AlertManagement::AlertStatusCountsResolver - field :alert_management_integrations, - Types::AlertManagement::IntegrationType.connection_type, + field :alert_management_integrations, Types::AlertManagement::IntegrationType.connection_type, null: true, description: 'Integrations which can receive alerts for the project.', resolver: Resolvers::AlertManagement::IntegrationsResolver - field :alert_management_http_integrations, - Types::AlertManagement::HttpIntegrationType.connection_type, + field :alert_management_http_integrations, Types::AlertManagement::HttpIntegrationType.connection_type, null: true, description: 'HTTP Integrations which can receive alerts for the project.', resolver: Resolvers::AlertManagement::HttpIntegrationsResolver - field :incident_management_timeline_events, - Types::IncidentManagement::TimelineEventType.connection_type, + field :incident_management_timeline_events, Types::IncidentManagement::TimelineEventType.connection_type, null: true, description: 'Incident Management Timeline events associated with the incident.', extras: [:lookahead], resolver: Resolvers::IncidentManagement::TimelineEventsResolver - field :incident_management_timeline_event, - Types::IncidentManagement::TimelineEventType, + field :incident_management_timeline_event, Types::IncidentManagement::TimelineEventType, null: true, description: 'Incident Management Timeline event associated with the incident.', resolver: Resolvers::IncidentManagement::TimelineEventsResolver.single - field :releases, - Types::ReleaseType.connection_type, + field :releases, Types::ReleaseType.connection_type, null: true, description: 'Releases of the project.', resolver: Resolvers::ReleasesResolver - field :release, - Types::ReleaseType, + field :release, Types::ReleaseType, null: true, description: 'A single release of the project.', resolver: Resolvers::ReleasesResolver.single, authorize: :read_release - field :container_expiration_policy, - Types::ContainerExpirationPolicyType, + field :container_expiration_policy, Types::ContainerExpirationPolicyType, null: true, description: 'Container expiration policy of the project.' - field :container_repositories, - Types::ContainerRepositoryType.connection_type, + field :container_repositories, Types::ContainerRepositoryType.connection_type, null: true, description: 'Container repositories of the project.', resolver: Resolvers::ContainerRepositoriesResolver - field :container_repositories_count, GraphQL::Types::Int, null: false, - description: 'Number of container repositories in the project.' + field :container_repositories_count, GraphQL::Types::Int, + null: false, + description: 'Number of container repositories in the project.' - field :label, - Types::LabelType, + field :label, Types::LabelType, null: true, description: 'Label available on this project.' do argument :title, GraphQL::Types::String, @@ -372,68 +423,63 @@ module Types description: 'Title of the label.' end - field :terraform_state, - Types::Terraform::StateType, + field :terraform_state, Types::Terraform::StateType, null: true, description: 'Find a single Terraform state by name.', resolver: Resolvers::Terraform::StatesResolver.single - field :terraform_states, - Types::Terraform::StateType.connection_type, + field :terraform_states, Types::Terraform::StateType.connection_type, null: true, description: 'Terraform states associated with the project.', resolver: Resolvers::Terraform::StatesResolver - field :pipeline_analytics, Types::Ci::AnalyticsType, null: true, - description: 'Pipeline analytics.', - resolver: Resolvers::ProjectPipelineStatisticsResolver + field :pipeline_analytics, Types::Ci::AnalyticsType, + null: true, + description: 'Pipeline analytics.', + resolver: Resolvers::ProjectPipelineStatisticsResolver - field :ci_template, Types::Ci::TemplateType, null: true, - description: 'Find a single CI/CD template by name.', - resolver: Resolvers::Ci::TemplateResolver + field :ci_template, Types::Ci::TemplateType, + null: true, + description: 'Find a single CI/CD template by name.', + resolver: Resolvers::Ci::TemplateResolver - field :ci_job_token_scope, Types::Ci::JobTokenScopeType, null: true, - description: 'The CI Job Tokens scope of access.', - resolver: Resolvers::Ci::JobTokenScopeResolver + field :ci_job_token_scope, Types::Ci::JobTokenScopeType, + null: true, + description: 'The CI Job Tokens scope of access.', + resolver: Resolvers::Ci::JobTokenScopeResolver - field :timelogs, - Types::TimelogType.connection_type, null: true, - description: 'Time logged on issues and merge requests in the project.', - extras: [:lookahead], - complexity: 5, - resolver: ::Resolvers::TimelogResolver + field :timelogs, Types::TimelogType.connection_type, + null: true, + description: 'Time logged on issues and merge requests in the project.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver - field :agent_configurations, - ::Types::Kas::AgentConfigurationType.connection_type, + field :agent_configurations, ::Types::Kas::AgentConfigurationType.connection_type, null: true, description: 'Agent configurations defined by the project', resolver: ::Resolvers::Kas::AgentConfigurationsResolver - field :cluster_agent, - ::Types::Clusters::AgentType, + field :cluster_agent, ::Types::Clusters::AgentType, null: true, description: 'Find a single cluster agent by name.', resolver: ::Resolvers::Clusters::AgentsResolver.single - field :cluster_agents, - ::Types::Clusters::AgentType.connection_type, + field :cluster_agents, ::Types::Clusters::AgentType.connection_type, extras: [:lookahead], null: true, description: 'Cluster agents associated with the project.', resolver: ::Resolvers::Clusters::AgentsResolver - field :merge_commit_template, - GraphQL::Types::String, + field :merge_commit_template, GraphQL::Types::String, null: true, description: 'Template used to create merge commit message in merge requests.' - field :squash_commit_template, - GraphQL::Types::String, + field :squash_commit_template, GraphQL::Types::String, null: true, description: 'Template used to create squash commit message in merge requests.' - field :labels, - Types::LabelType.connection_type, + field :labels, Types::LabelType.connection_type, null: true, description: 'Labels available on this project.', resolver: Resolvers::LabelsResolver @@ -444,8 +490,7 @@ module Types ' Returns `null` if `work_items` feature flag is disabled.' \ ' This flag is disabled by default, because the feature is experimental and is subject to change without notice.' - field :timelog_categories, - Types::TimeTracking::TimelogCategoryType.connection_type, + field :timelog_categories, Types::TimeTracking::TimelogCategoryType.connection_type, null: true, description: "Timelog categories for the project.", alpha: { milestone: '15.3' } diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 321a6e9395e..3293db970c8 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -434,7 +434,8 @@ module ApplicationSettingsHelper :runner_token_expiration_interval, :group_runner_token_expiration_interval, :project_runner_token_expiration_interval, - :pipeline_limit_per_project_user_sha + :pipeline_limit_per_project_user_sha, + :invitation_flow_enforcement ].tap do |settings| settings << :deactivate_dormant_users unless Gitlab.com? end diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 579f2c38ae6..9a2a60fd7ad 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -406,6 +406,10 @@ class ApplicationSetting < ApplicationRecord validates :invisible_captcha_enabled, inclusion: { in: [true, false], message: _('must be a boolean value') } + validates :invitation_flow_enforcement, + allow_nil: false, + inclusion: { in: [true, false], message: _('must be a boolean value') } + Gitlab::SSHPublicKey.supported_types.each do |type| validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type } end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index dc6423f6bf4..d9e8873ffc1 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -703,7 +703,7 @@ module Ci end def has_test_reports? - job_artifacts.test_reports.exists? + job_artifacts.of_report_type(:test).exists? end def has_old_trace? @@ -1290,7 +1290,7 @@ module Ci end def observe_report_types - return unless ::Gitlab.com? && Feature.enabled?(:report_artifact_build_completed_metrics_on_build_completion) + return unless ::Gitlab.com? report_types = options&.dig(:artifacts, :reports)&.keys || [] diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 8b41ade90df..f0a4402e8aa 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -159,12 +159,6 @@ module Ci where(file_type: types) end - REPORT_FILE_TYPES.each do |report_type, file_types| - scope "#{report_type}_reports", -> do - with_file_types(file_types) - end - end - scope :all_reports, -> do with_file_types(REPORT_TYPES.keys.map(&:to_s)) end @@ -245,8 +239,14 @@ module Ci end end + def self.of_report_type(report_type) + file_types = file_types_for_report(report_type) + + with_file_types(file_types) + end + def self.file_types_for_report(report_type) - REPORT_FILE_TYPES.fetch(report_type) + REPORT_FILE_TYPES.fetch(report_type) { raise ArgumentError, "Unrecognized report type: #{report_type}" } end def self.associated_file_types_for(file_type) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index a94330270e2..621d198d341 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -1052,7 +1052,7 @@ module Ci end def latest_test_report_builds - latest_report_builds(Ci::JobArtifact.test_reports).preload(:project, :metadata) + latest_report_builds(Ci::JobArtifact.of_report_type(:test)).preload(:project, :metadata) end def latest_report_builds_in_self_and_descendants(reports_scope = ::Ci::JobArtifact.all_reports) @@ -1084,7 +1084,7 @@ module Ci end def can_generate_codequality_reports? - has_reports?(Ci::JobArtifact.codequality_reports) + has_reports?(Ci::JobArtifact.of_report_type(:codequality)) end def test_report_summary @@ -1103,7 +1103,7 @@ module Ci def accessibility_reports Gitlab::Ci::Reports::AccessibilityReports.new.tap do |accessibility_reports| - latest_report_builds(Ci::JobArtifact.accessibility_reports).each do |build| + latest_report_builds(Ci::JobArtifact.of_report_type(:accessibility)).each do |build| build.collect_accessibility_reports!(accessibility_reports) end end @@ -1111,7 +1111,7 @@ module Ci def codequality_reports Gitlab::Ci::Reports::CodequalityReports.new.tap do |codequality_reports| - latest_report_builds(Ci::JobArtifact.codequality_reports).each do |build| + latest_report_builds(Ci::JobArtifact.of_report_type(:codequality)).each do |build| build.collect_codequality_reports!(codequality_reports) end end @@ -1119,7 +1119,7 @@ module Ci def terraform_reports ::Gitlab::Ci::Reports::TerraformReports.new.tap do |terraform_reports| - latest_report_builds(::Ci::JobArtifact.terraform_reports).each do |build| + latest_report_builds(::Ci::JobArtifact.of_report_type(:terraform)).each do |build| build.collect_terraform_reports!(terraform_reports) end end @@ -1307,7 +1307,7 @@ module Ci def has_test_reports? strong_memoize(:has_test_reports) do - has_reports?(::Ci::JobArtifact.test_reports) + has_reports?(::Ci::JobArtifact.of_report_type(:test)) end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 30dc29fa2d8..81b264a9ed7 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -293,16 +293,6 @@ class Issue < ApplicationRecord def pg_full_text_search(search_term) super.where('issue_search_data.project_id = issues.project_id') end - - override :full_search - def full_search(query, matched_columns: nil, use_minimum_char_limit: true) - return super if query.match?(IssuableFinder::FULL_TEXT_SEARCH_TERM_REGEX) - - super.where( - 'issues.title NOT SIMILAR TO :pattern OR issues.description NOT SIMILAR TO :pattern', - pattern: IssuableFinder::FULL_TEXT_SEARCH_TERM_PATTERN - ) - end end def next_object_by_relative_position(ignoring: nil, order: :asc) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 7d094d774d8..906e1f1e632 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1588,7 +1588,7 @@ class MergeRequest < ApplicationRecord end def has_test_reports? - actual_head_pipeline&.has_reports?(Ci::JobArtifact.test_reports) + actual_head_pipeline&.has_reports?(Ci::JobArtifact.of_report_type(:test)) end def predefined_variables @@ -1618,7 +1618,7 @@ class MergeRequest < ApplicationRecord end def has_accessibility_reports? - actual_head_pipeline.present? && actual_head_pipeline.has_reports?(Ci::JobArtifact.accessibility_reports) + actual_head_pipeline.present? && actual_head_pipeline.has_reports?(Ci::JobArtifact.of_report_type(:accessibility)) end def has_coverage_reports? @@ -1626,7 +1626,7 @@ class MergeRequest < ApplicationRecord end def has_terraform_reports? - actual_head_pipeline&.has_reports?(Ci::JobArtifact.terraform_reports) + actual_head_pipeline&.has_reports?(Ci::JobArtifact.of_report_type(:terraform)) end def compare_accessibility_reports @@ -1666,7 +1666,7 @@ class MergeRequest < ApplicationRecord end def has_codequality_reports? - actual_head_pipeline&.has_reports?(Ci::JobArtifact.codequality_reports) + actual_head_pipeline&.has_reports?(Ci::JobArtifact.of_report_type(:codequality)) end def compare_codequality_reports @@ -1716,11 +1716,11 @@ class MergeRequest < ApplicationRecord end def has_sast_reports? - !!actual_head_pipeline&.has_reports?(::Ci::JobArtifact.sast_reports) + !!actual_head_pipeline&.has_reports?(::Ci::JobArtifact.of_report_type(:sast)) end def has_secret_detection_reports? - !!actual_head_pipeline&.has_reports?(::Ci::JobArtifact.secret_detection_reports) + !!actual_head_pipeline&.has_reports?(::Ci::JobArtifact.of_report_type(:secret_detection)) end def compare_sast_reports(current_user) diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml index f914de138a9..f1debc06d42 100644 --- a/app/views/admin/application_settings/_account_and_limit.html.haml +++ b/app/views/admin/application_settings/_account_and_limit.html.haml @@ -60,6 +60,7 @@ = f.label :user_show_add_ssh_key_message, _('Prompt users to upload SSH keys'), class: 'label-bold' = f.gitlab_ui_checkbox_component :user_show_add_ssh_key_message, _("Inform users without uploaded SSH keys that they can't push over SSH until one is added") + = render 'admin/application_settings/invitation_flow_enforcement', form: f = render_if_exists 'admin/application_settings/updating_name_disabled_for_users', form: f = render_if_exists 'admin/application_settings/availability_on_namespace_setting', form: f = f.submit _('Save changes'), class: 'gl-button btn btn-confirm qa-save-changes-button' diff --git a/app/views/admin/application_settings/_invitation_flow_enforcement.html.haml b/app/views/admin/application_settings/_invitation_flow_enforcement.html.haml new file mode 100644 index 00000000000..895662b38fd --- /dev/null +++ b/app/views/admin/application_settings/_invitation_flow_enforcement.html.haml @@ -0,0 +1,8 @@ +- return unless ::Feature.enabled?(:invitation_flow_enforcement_setting) + +- form = local_assigns.fetch(:form) + +%fieldset.form-group.gl-form-group + %legend.col-form-label.col-form-label + = s_("AdminSettings|Enforce invitation flow for groups and projects") + = form.gitlab_ui_checkbox_component :invitation_flow_enforcement, s_("AdminSettings|Users and groups must accept the invitation before they're added to a group or project.") diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index a8ad53db8c2..78e404d15c6 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -42,7 +42,7 @@ #js-pipeline-tests-detail{ data: { summary_endpoint: summary_project_pipeline_tests_path(@project, @pipeline, format: :json), suite_endpoint: project_pipeline_test_path(@project, @pipeline, suite_name: 'suite', format: :json), blob_path: project_blob_path(@project, @pipeline.sha), - has_test_report: @pipeline.has_reports?(Ci::JobArtifact.test_reports).to_s, + has_test_report: @pipeline.has_reports?(Ci::JobArtifact.of_report_type(:test)).to_s, empty_state_image_path: image_path('illustrations/empty-state/empty-test-cases-lg.svg'), artifacts_expired_image_path: image_path('illustrations/pipeline.svg') } } = render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project diff --git a/config/feature_flags/development/report_artifact_build_completed_metrics_on_build_completion.yml b/config/feature_flags/development/invitation_flow_enforcement_setting.yml similarity index 55% rename from config/feature_flags/development/report_artifact_build_completed_metrics_on_build_completion.yml rename to config/feature_flags/development/invitation_flow_enforcement_setting.yml index 76b6c8c6b2f..39da6c40bed 100644 --- a/config/feature_flags/development/report_artifact_build_completed_metrics_on_build_completion.yml +++ b/config/feature_flags/development/invitation_flow_enforcement_setting.yml @@ -1,8 +1,8 @@ --- -name: report_artifact_build_completed_metrics_on_build_completion -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80334 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/369500 -milestone: '15.3' +name: invitation_flow_enforcement_setting +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92218 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/367666 +milestone: '15.4' type: development -group: group::static analysis +group: group::workspace default_enabled: false diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index 61e27f9aeb8..ff7221b5d9e 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -333,6 +333,8 @@ - 1 - - object_storage - 1 +- - onboarding_create_learn_gitlab + - 1 - - package_cleanup - 1 - - package_repositories diff --git a/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb b/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb new file mode 100644 index 00000000000..f323faf9aa1 --- /dev/null +++ b/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddInvitationFlowEnforcementToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :invitation_flow_enforcement, + :boolean, + default: false, + null: false + end +end diff --git a/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb b/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb new file mode 100644 index 00000000000..1c5a1b68041 --- /dev/null +++ b/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddNoteMetadataTempIndexOnIdWhereTask < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_system_note_metadata_on_id_where_task' + + disable_ddl_transaction! + + def up + add_concurrent_index :system_note_metadata, [:id, :action], where: "action = 'task'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME + end +end diff --git a/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb b/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb new file mode 100644 index 00000000000..df7c2d325d2 --- /dev/null +++ b/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class ChangeTaskSystemNoteWordingToChecklistItem < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + MIGRATION = 'RenameTaskSystemNoteToChecklistItem' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + MAX_BATCH_SIZE = 20_000 + SUB_BATCH_SIZE = 100 + + def up + queue_batched_background_migration( + MIGRATION, + :system_note_metadata, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :system_note_metadata, :id, []) + end +end diff --git a/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb new file mode 100644 index 00000000000..a8ea6abdcba --- /dev/null +++ b/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class PrepareRemovalPartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0] + TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin' + DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin' + + def up + prepare_async_index_removal :issues, :title, name: TITLE_INDEX_NAME + prepare_async_index_removal :issues, :description, name: DESCRIPTION_INDEX_NAME + end + + def down + unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME + unprepare_async_index_by_name :issues, TITLE_INDEX_NAME + end +end diff --git a/db/schema_migrations/20220711142148 b/db/schema_migrations/20220711142148 new file mode 100644 index 00000000000..709ce89616a --- /dev/null +++ b/db/schema_migrations/20220711142148 @@ -0,0 +1 @@ +d7062e116066ac922d42f43ef8ee6783d6bc3a30d6c36b4d70788ce47bba076f \ No newline at end of file diff --git a/db/schema_migrations/20220809214730 b/db/schema_migrations/20220809214730 new file mode 100644 index 00000000000..0358f9b1798 --- /dev/null +++ b/db/schema_migrations/20220809214730 @@ -0,0 +1 @@ +ac9e478c7aaa351059d38dddf9a94eda7481a2bbcd4e9e5361fffb0c999be945 \ No newline at end of file diff --git a/db/schema_migrations/20220809223215 b/db/schema_migrations/20220809223215 new file mode 100644 index 00000000000..84f5e9314a5 --- /dev/null +++ b/db/schema_migrations/20220809223215 @@ -0,0 +1 @@ +1f383c2db106880e8a909b9292023ae099e224d733c87e356c61038bc84cf702 \ No newline at end of file diff --git a/db/schema_migrations/20220823084747 b/db/schema_migrations/20220823084747 new file mode 100644 index 00000000000..d748dee5916 --- /dev/null +++ b/db/schema_migrations/20220823084747 @@ -0,0 +1 @@ +f192ab50bed6dd03ae9c9c51c89d870ad6d2d1cbae129ed2da31fc061b9901d4 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 98622c25058..a8093bf3ceb 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -11490,6 +11490,7 @@ CREATE TABLE application_settings ( error_tracking_api_url text, git_rate_limit_users_allowlist text[] DEFAULT '{}'::text[] NOT NULL, error_tracking_access_token_encrypted text, + invitation_flow_enforcement boolean DEFAULT false NOT NULL, package_registry_cleanup_policies_worker_capacity integer DEFAULT 2 NOT NULL, deactivate_dormant_users_period integer DEFAULT 90 NOT NULL, auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, @@ -30659,6 +30660,8 @@ CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0); +CREATE INDEX tmp_index_system_note_metadata_on_id_where_task ON system_note_metadata USING btree (id, action) WHERE ((action)::text = 'task'::text); + CREATE INDEX tmp_index_todos_attention_request_action ON todos USING btree (id) WHERE (action = 10); CREATE INDEX tmp_index_vulnerability_occurrences_on_id_and_scanner_id ON vulnerability_occurrences USING btree (id, scanner_id) WHERE (report_type = ANY (ARRAY[7, 99])); diff --git a/doc/ci/pipelines/merge_request_pipelines.md b/doc/ci/pipelines/merge_request_pipelines.md index 5ba489c9830..f6c93356046 100644 --- a/doc/ci/pipelines/merge_request_pipelines.md +++ b/doc/ci/pipelines/merge_request_pipelines.md @@ -218,3 +218,28 @@ is not considered successful if: When using the [merge when pipeline succeeds](../../user/project/merge_requests/merge_when_pipeline_succeeds.md) feature and both pipelines types are present, the merge request pipelines are checked, not the branch pipelines. + +### `An error occurred while trying to run a new pipeline for this merge request.` + +This error can happen when you select **Run pipeline** in a merge request, but the +project does not have merge request pipelines enabled anymore. + +Some possible reasons for this error message: + +- The project does not have merge request pipelines enabled, has no pipelines listed + in the **Pipelines** tab, and you select **Run pipelines**. +- The project used to have merge request pipelines enabled, but the configuration + was removed. For example: + + 1. The project has merge request pipelines enabled in the `.gitlab-ci.yml` configuration + file when the merge request is created. + 1. The **Run pipeline** options is available in the merge request's **Pipelines** tab, + and selecting **Run pipeline** at this point likely does not cause any errors. + 1. The project's `.gitlab-ci.yml` file is changed to remove the merge request pipelines configuration. + 1. The branch is rebased to bring the updated configuration into the merge request. + 1. Now the pipeline configuration no longer supports merge request pipelines, + but you select **Run pipeline** to run a merge request pipeline. + +If **Run pipeline** is available, but the project does not have merge request pipelines +enabled, do not use this option. You can push a commit or rebase the branch to trigger +new branch pipelines. diff --git a/doc/development/shell_scripting_guide/index.md b/doc/development/shell_scripting_guide/index.md index 3d58fabad72..0591d2c64d0 100644 --- a/doc/development/shell_scripting_guide/index.md +++ b/doc/development/shell_scripting_guide/index.md @@ -38,7 +38,7 @@ in a particular case. According to the [GitLab installation requirements](../../install/requirements.md), this guide covers only those shells that are used by -[supported Linux distributions](../../install/requirements.md#supported-linux-distributions), +[supported Linux distributions](../../administration/package_information/supported_os.md#supported-operating-systems), that is: - [POSIX Shell](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html) diff --git a/doc/install/azure/index.md b/doc/install/azure/index.md index 7f155a78140..782918dba32 100644 --- a/doc/install/azure/index.md +++ b/doc/install/azure/index.md @@ -294,7 +294,7 @@ up-to-date GitLab instance. ## Next steps and further configuration Now that you have a functional GitLab instance, follow the -[next steps](../index.md#next-steps) to learn what more you can do with your +[next steps](../next_steps.md) to learn what more you can do with your new installation. ## Troubleshooting diff --git a/doc/install/google_cloud_platform/index.md b/doc/install/google_cloud_platform/index.md index b63ab8d4e2b..d296d4d78f4 100644 --- a/doc/install/google_cloud_platform/index.md +++ b/doc/install/google_cloud_platform/index.md @@ -42,7 +42,7 @@ To deploy GitLab on GCP you must create a virtual machine: ![Launch on Compute Engine](img/vm_details.png) -1. To select the size, type, and desired [operating system](../requirements.md#supported-linux-distributions), +1. To select the size, type, and desired [operating system](../../administration/package_information/supported_os.md#supported-operating-systems), select **Change** under `Boot disk`. select **Select** when finished. 1. As a last step allow HTTP and HTTPS traffic, then select **Create**. The process finishes in a few seconds. diff --git a/doc/install/index.md b/doc/install/index.md index 413c5116c14..89203c652d1 100644 --- a/doc/install/index.md +++ b/doc/install/index.md @@ -7,46 +7,14 @@ description: Read through the GitLab installation methods. type: index --- -# Installation **(FREE SELF)** +# Install GitLab **(FREE SELF)** -GitLab can be installed in most GNU/Linux distributions, and with several -cloud providers. To get the best experience from GitLab, you must balance -performance, reliability, ease of administration (backups, upgrades, and -troubleshooting), and the cost of hosting. +You can install GitLab on most GNU/Linux distributions, on several +cloud providers, and in Kubernetes clusters. -## Requirements +To get the best experience, you should balance performance, reliability, +ease of administration (backups, upgrades, and troubleshooting) with the cost of hosting. -Before you install GitLab, be sure to review the [system requirements](requirements.md). -The system requirements include details about the minimum hardware, software, -database, and additional requirements to support GitLab. +To get started, [choose your installation method](install_methods.md). -## Choose the installation method - -Depending on your platform, select from the following available methods to -install GitLab: - -| Installation method | Description | When to choose | -|----------------------------------------------------------------|-------------|----------------| -| [Linux package](https://docs.gitlab.com/omnibus/installation/) | The official deb/rpm packages (also known as Omnibus GitLab) that contains a bundle of GitLab and the components it depends on, including PostgreSQL, Redis, and Sidekiq. | This method is recommended for getting started. The Linux packages are mature, scalable, and are used today on GitLab.com. If you need additional flexibility and resilience, we recommend deploying GitLab as described in the [reference architecture documentation](../administration/reference_architectures/index.md). | -| [Helm charts](https://docs.gitlab.com/charts/) | The cloud native Helm chart for installing GitLab and all of its components on Kubernetes. | When installing GitLab on Kubernetes, it has some trade-offs that you must be aware of:
- Administration and troubleshooting requires Kubernetes knowledge.
- It can be more expensive for smaller installations. The default installation requires more resources than a single node Linux package deployment, as most services are deployed in a redundant fashion.

Use this method if your infrastructure is built on Kubernetes and you're familiar with how it works. The methods for management, observability, and some concepts are different than traditional deployments. | -| [Docker](docker.md) | The GitLab packages, Dockerized. | Use this method if you're familiar with Docker. | -| [Source](installation.md) | Install GitLab and all of its components from scratch. | Use this method if none of the previous methods are available for your platform. Can be used for unsupported systems like \*BSD.| -| [GitLab Environment Toolkit (GET)](https://gitlab.com/gitlab-org/gitlab-environment-toolkit#documentation) | The GitLab Environment toolkit provides a set of automation tools to deploy a [reference architecture](../administration/reference_architectures/index.md) on most major cloud providers. | Customers are very welcome to trial and evaluate GET today, however be aware of [key limitations](https://gitlab.com/gitlab-org/gitlab-environment-toolkit#missing-features-to-be-aware-of) of the current iteration. For production environments further manual setup is required based on your specific requirements. | -| [GitLab Operator](https://docs.gitlab.com/operator/) | The GitLab Operator provides an installation and management method for GitLab following the [Kubernetes Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/). | Use the GitLab Operator to run GitLab in an [OpenShift](openshift_and_gitlab/index.md) environment. | - -## Install GitLab on cloud providers - -Regardless of the installation method, you can install GitLab on several cloud -providers, assuming the cloud provider supports it. Here are several possible installation -methods, the majority which use the Linux packages: - -| Cloud provider | Description | -|---------------------------------------------------------------|-------------| -| [AWS (HA)](aws/index.md) | Install GitLab on AWS using the community AMIs provided by GitLab. | -| [Google Cloud Platform (GCP)](google_cloud_platform/index.md) | Install GitLab on a VM in GCP. | -| [Azure](azure/index.md) | Install GitLab from Azure Marketplace. | - -## Next steps - -After you complete the steps for installing GitLab, you can -[configure your instance](next_steps.md). +If you already have a running instance, learn how to [configure it](next_steps.md). diff --git a/doc/install/install_methods.md b/doc/install/install_methods.md new file mode 100644 index 00000000000..6c62deba6fa --- /dev/null +++ b/doc/install/install_methods.md @@ -0,0 +1,51 @@ +--- +stage: Systems +group: Distribution +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 +comments: false +description: Read through the GitLab installation methods. +type: index +--- + +# Installation methods + +You can install GitLab by using any of the following methods. + +| Installation method | Description | When to choose | +|----------------------------------------------------------------|-------------|----------------| +| [Linux package](https://docs.gitlab.com/omnibus/installation/) | The official deb/rpm packages (also known as Omnibus GitLab). The package has GitLab and dependent components, including PostgreSQL, Redis, and Sidekiq. | Use if you want the most mature, scalable method. This version is also used on GitLab.com.
- For additional flexibility and resilience, see the [reference architecture documentation](../administration/reference_architectures/index.md).
- Review the [system requirements](requirements.md).
- View the [list of supported Linux operating systems](../administration/package_information/supported_os.md#supported-operating-systems). | +| [Helm chart](https://docs.gitlab.com/charts/) | A chart for installing a cloud-native version of GitLab and its components on Kubernetes. | Use if your infrastructure is on Kubernetes and you're familiar with how it works. Management, observability, and some concepts are different than traditional deployments.
- Administration and troubleshooting requires Kubernetes knowledge.
- It can be more expensive for smaller installations. The default installation requires more resources than a single node Linux package deployment, because most services are deployed in a redundant fashion.

| +| [Docker](docker.md) | The GitLab packages in a Docker container. | Use if you're familiar with Docker. | +| [Source](installation.md) | GitLab and its components from scratch. | Use if none of the previous methods are available for your platform. Can use for unsupported systems like \*BSD.| +| [GitLab Environment Toolkit (GET)](https://gitlab.com/gitlab-org/gitlab-environment-toolkit#documentation) | A set of automation tools. | Use to deploy a [reference architecture](../administration/reference_architectures/index.md) on most major cloud providers. Has some [limitations](https://gitlab.com/gitlab-org/gitlab-environment-toolkit#missing-features-to-be-aware-of) and manual setup for production environments. | +| [GitLab Operator](https://docs.gitlab.com/operator/) | An installation and management method that follows the [Kubernetes Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/). | Use to run GitLab in an [OpenShift](openshift_and_gitlab/index.md) environment. | + +## Cloud providers + +You can install GitLab on several cloud providers. + +| Cloud provider | Description | +|---------------------------------------------------------------|-------------| +| [AWS (HA)](aws/index.md) | Install GitLab on AWS using the community AMIs provided by GitLab. | +| [Google Cloud Platform (GCP)](google_cloud_platform/index.md) | Install GitLab on a VM in GCP. | +| [Azure](azure/index.md) | Install GitLab from Azure Marketplace. | + +## Unsupported Linux distributions and Unix-like operating systems + +- Arch Linux +- Fedora +- FreeBSD +- Gentoo +- macOS + +Installation of GitLab on these operating systems is possible, but not supported. +See the [installation from source guide](installation.md) and the [installation guides](https://about.gitlab.com/install/) for more information. + +See [OS versions that are no longer supported](../administration/package_information/supported_os.md#os-versions-that-are-no-longer-supported) for Omnibus installs page +for a list of supported and unsupported OS versions as well as the last support GitLab version for that OS. + +## Microsoft Windows + +GitLab is developed for Linux-based operating systems. +It does **not** run on Microsoft Windows, and we have no plans to support it in the near future. For the latest development status, view this [issue](https://gitlab.com/gitlab-org/gitlab/-/issues/22337). +Consider using a virtual machine to run GitLab. diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 93d66dc92a9..03870897417 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -4,38 +4,9 @@ group: Distribution 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 --- -# GitLab installation minimum requirements **(FREE SELF)** +# Installation system requirements **(FREE SELF)** -This page includes information about both the supported operating systems and -the minimum requirements needed to install and use GitLab. - -## Operating Systems - -### Supported Linux distributions - -See the [list of supported operating systems](../administration/package_information/supported_os.md#supported-operating-systems). - -For the installation options, see [the main installation page](index.md). - -### Unsupported Linux distributions and Unix-like operating systems - -- Arch Linux -- Fedora -- FreeBSD -- Gentoo -- macOS - -Installation of GitLab on these operating systems is possible, but not supported. -See the [installation from source guide](installation.md) and the [installation guides](https://about.gitlab.com/install/) for more information. - -See [OS versions that are no longer supported](../administration/package_information/supported_os.md#os-versions-that-are-no-longer-supported) for Omnibus installs page -for a list of supported and unsupported OS versions as well as the last support GitLab version for that OS. - -### Microsoft Windows - -GitLab is developed for Linux-based operating systems. -It does **not** run on Microsoft Windows, and we have no plans to support it in the near future. For the latest development status view this [issue](https://gitlab.com/gitlab-org/gitlab/-/issues/22337). -Consider using a virtual machine to run GitLab. +This page includes information about the minimum requirements you need to install and use GitLab. ## Software requirements diff --git a/lib/gitlab/auth/o_auth/provider.rb b/lib/gitlab/auth/o_auth/provider.rb index 2c2fb743927..2ce8677c8b7 100644 --- a/lib/gitlab/auth/o_auth/provider.rb +++ b/lib/gitlab/auth/o_auth/provider.rb @@ -68,7 +68,9 @@ module Gitlab nil end else - provider = Gitlab.config.omniauth.providers.find { |provider| provider.name == name } + provider = Gitlab.config.omniauth.providers.find do |provider| + provider.name == name || (provider.name == 'openid_connect' && provider.args.name == name) + end merge_provider_args_with_defaults!(provider) provider diff --git a/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item.rb b/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item.rb new file mode 100644 index 00000000000..718fb0aaa71 --- /dev/null +++ b/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + # Renames all system notes created when an issuable task is checked/unchecked + # from `task` into `checklist item` + # `marked the task **Task 1** as incomplete` => `marked the checklist item **Task 1** as incomplete` + class RenameTaskSystemNoteToChecklistItem < BatchedMigrationJob + REPLACE_REGEX = '\Amarked\sthe\stask' + TEXT_REPLACEMENT = 'marked the checklist item' + + scope_to ->(relation) { + relation.where(system_note_metadata: { action: :task }) + } + + def perform + each_sub_batch(operation_name: :update_all) do |sub_batch| + ApplicationRecord.connection.execute <<~SQL + UPDATE notes + SET note = REGEXP_REPLACE(notes.note,'#{REPLACE_REGEX}', '#{TEXT_REPLACEMENT}') + FROM (#{sub_batch.select(:note_id).to_sql}) AS metadata_fields(note_id) + WHERE notes.id = note_id + SQL + end + end + end + end +end diff --git a/lib/gitlab/ci/reports/coverage_report_generator.rb b/lib/gitlab/ci/reports/coverage_report_generator.rb index 6d57e05aa63..5625707431a 100644 --- a/lib/gitlab/ci/reports/coverage_report_generator.rb +++ b/lib/gitlab/ci/reports/coverage_report_generator.rb @@ -35,7 +35,7 @@ module Gitlab private def report_builds - @pipeline.latest_report_builds_in_self_and_descendants(::Ci::JobArtifact.coverage_reports) + @pipeline.latest_report_builds_in_self_and_descendants(::Ci::JobArtifact.of_report_type(:coverage)) end end end diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 6f36a09fe48..9920b72aa52 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -137,7 +137,7 @@ module Gitlab projects_with_error_tracking_enabled: count(::ErrorTracking::ProjectErrorTrackingSetting.where(enabled: true)), projects_with_alerts_created: distinct_count(::AlertManagement::Alert, :project_id), projects_with_enabled_alert_integrations: distinct_count(::AlertManagement::HttpIntegration.active, :project_id), - projects_with_terraform_reports: distinct_count(::Ci::JobArtifact.terraform_reports, :project_id), + projects_with_terraform_reports: distinct_count(::Ci::JobArtifact.of_report_type(:terraform), :project_id), projects_with_terraform_states: distinct_count(::Terraform::State, :project_id), protected_branches: count(ProtectedBranch), protected_branches_except_default: count(ProtectedBranch.where.not(name: ['main', 'master', Gitlab::CurrentSettings.default_branch_name])), @@ -146,7 +146,7 @@ module Gitlab personal_snippets: count(PersonalSnippet), project_snippets: count(ProjectSnippet), suggestions: count(Suggestion), - terraform_reports: count(::Ci::JobArtifact.terraform_reports), + terraform_reports: count(::Ci::JobArtifact.of_report_type(:terraform)), terraform_states: count(::Terraform::State), todos: count(Todo), uploads: count(Upload), diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake index f6c518784a9..d695547b0b1 100644 --- a/lib/tasks/gitlab/tw/codeowners.rake +++ b/lib/tasks/gitlab/tw/codeowners.rake @@ -28,7 +28,7 @@ namespace :tw do CodeOwnerRule.new('Code Review', '@aqualls'), CodeOwnerRule.new('Compliance', '@eread'), CodeOwnerRule.new('Composition Analysis', '@rdickenson'), - CodeOwnerRule.new('Configure', '@sselhorn'), + CodeOwnerRule.new('Configure', '@phillipwells'), CodeOwnerRule.new('Container Security', '@claytoncornell'), CodeOwnerRule.new('Contributor Experience', '@eread'), CodeOwnerRule.new('Conversion', '@kpaizee'), diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 50fd2644600..553f2f4cb5f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -2721,6 +2721,9 @@ msgstr "" msgid "AdminSettings|Enabled" msgstr "" +msgid "AdminSettings|Enforce invitation flow for groups and projects" +msgstr "" + msgid "AdminSettings|Feed token" msgstr "" @@ -2889,6 +2892,9 @@ msgstr "" msgid "AdminSettings|Use AWS hosted Elasticsearch with IAM credentials" msgstr "" +msgid "AdminSettings|Users and groups must accept the invitation before they're added to a group or project." +msgstr "" + msgid "AdminSettings|When paused, GitLab still tracks the changes. This is useful for cluster/index migrations." msgstr "" diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index e02589ddc83..cb25011fd96 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -362,6 +362,17 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set expect(application_settings.reload.pipeline_limit_per_project_user_sha).to eq(25) end end + + context 'invitation flow enforcement setting' do + let(:application_settings) { ApplicationSetting.current } + + it 'updates invitation_flow_enforcement setting' do + put :update, params: { application_setting: { invitation_flow_enforcement: true } } + + expect(response).to redirect_to(general_admin_application_settings_path) + expect(application_settings.reload.invitation_flow_enforcement).to eq(true) + end + end end describe 'PUT #reset_registration_token' do diff --git a/spec/helpers/projects/pipeline_helper_spec.rb b/spec/helpers/projects/pipeline_helper_spec.rb index 8ce4e9f5293..1231dcef693 100644 --- a/spec/helpers/projects/pipeline_helper_spec.rb +++ b/spec/helpers/projects/pipeline_helper_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Projects::PipelineHelper do summary_endpoint: summary_project_pipeline_tests_path(project, pipeline, format: :json), suite_endpoint: project_pipeline_test_path(project, pipeline, suite_name: 'suite', format: :json), blob_path: project_blob_path(project, pipeline.sha), - has_test_report: pipeline.has_reports?(Ci::JobArtifact.test_reports), + has_test_report: pipeline.has_reports?(Ci::JobArtifact.of_report_type(:test)), empty_state_image_path: match_asset_path('illustrations/empty-state/empty-test-cases-lg.svg'), artifacts_expired_image_path: match_asset_path('illustrations/pipeline.svg') }) diff --git a/spec/lib/gitlab/auth/o_auth/provider_spec.rb b/spec/lib/gitlab/auth/o_auth/provider_spec.rb index c1b96819176..96a31c50989 100644 --- a/spec/lib/gitlab/auth/o_auth/provider_spec.rb +++ b/spec/lib/gitlab/auth/o_auth/provider_spec.rb @@ -90,6 +90,24 @@ RSpec.describe Gitlab::Auth::OAuth::Provider do end end end + + context 'for an OpenID Connect provider' do + before do + provider = ActiveSupport::InheritableOptions.new( + name: 'openid_connect', + args: ActiveSupport::InheritableOptions.new(name: 'custom_oidc') + ) + allow(Gitlab.config.omniauth).to receive(:providers).and_return([provider]) + end + + context 'when the provider exists' do + subject { described_class.config_for('custom_oidc') } + + it 'returns the config' do + expect(subject).to be_a(ActiveSupport::InheritableOptions) + end + end + end end describe '.label_for' do diff --git a/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb b/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb new file mode 100644 index 00000000000..6996249cb40 --- /dev/null +++ b/spec/lib/gitlab/background_migration/rename_task_system_note_to_checklist_item_spec.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::RenameTaskSystemNoteToChecklistItem do + let(:notes) { table(:notes) } + let(:projects) { table(:projects) } + + let(:namespace) { table(:namespaces).create!(name: 'batchtest1', type: 'Group', path: 'space1') } + let(:project) { table(:projects).create!(name: 'proj1', path: 'proj1', namespace_id: namespace.id) } + let(:issue) { table(:issues).create!(title: 'Test issue') } + + let!(:note1) do + notes.create!( + note: 'marked the task **Task 1** as complete', noteable_type: 'Issue', noteable_id: issue.id, system: true + ) + end + + let!(:note2) do + notes.create!( + note: 'NO_MATCH marked the task **Task 2** as complete', + noteable_type: 'Issue', + noteable_id: issue.id, + system: true + ) + end + + let!(:note3) do + notes.create!( + note: 'marked the task **Task 3** as incomplete', + noteable_type: 'Issue', + noteable_id: issue.id, + system: true + ) + end + + let!(:note4) do + notes.create!( + note: 'marked the task **Task 4** as incomplete', + noteable_type: 'Issue', + noteable_id: issue.id, + system: true + ) + end + + let!(:metadata1) { table(:system_note_metadata).create!(note_id: note1.id, action: :task) } + let!(:metadata2) { table(:system_note_metadata).create!(note_id: note2.id, action: :task) } + let!(:metadata3) { table(:system_note_metadata).create!(note_id: note3.id, action: :task) } + let!(:metadata4) { table(:system_note_metadata).create!(note_id: note4.id, action: :not_task) } + + let(:migration) do + described_class.new( + start_id: note1.id, + end_id: note4.id, + batch_table: :system_note_metadata, + batch_column: :id, + sub_batch_size: 2, + pause_ms: 2, + connection: ApplicationRecord.connection + ) + end + + subject(:perform_migration) { migration.perform } + + it 'renames task to checklist item in task system notes that match', :aggregate_failures do + expect do + perform_migration + + note1.reload + note2.reload + note3.reload + note4.reload + end.to change(note1, :note).to('marked the checklist item **Task 1** as complete').and( + not_change(note2, :note).from('NO_MATCH marked the task **Task 2** as complete') + ).and( + change(note3, :note).to('marked the checklist item **Task 3** as incomplete') + ).and( + not_change(note4, :note).from('marked the task **Task 4** as incomplete') + ) + end + + it 'updates in batches' do + expect { perform_migration }.to make_queries_matching(/UPDATE notes/, 2) + end + + it 'tracks timings of queries' do + expect(migration.batch_metrics.timings).to be_empty + + expect { perform_migration }.to change { migration.batch_metrics.timings } + end +end diff --git a/spec/migrations/change_task_system_note_wording_to_checklist_item_spec.rb b/spec/migrations/change_task_system_note_wording_to_checklist_item_spec.rb new file mode 100644 index 00000000000..039ee92f8bd --- /dev/null +++ b/spec/migrations/change_task_system_note_wording_to_checklist_item_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe ChangeTaskSystemNoteWordingToChecklistItem, :migration do + let(:migration) { described_class::MIGRATION } + + describe '#up' do + it 'schedules a batched background migration' do + migrate! + + expect(migration).to have_scheduled_batched_migration( + table_name: :system_note_metadata, + column_name: :id, + interval: described_class::DELAY_INTERVAL, + batch_size: described_class::BATCH_SIZE, + max_batch_size: described_class::MAX_BATCH_SIZE, + sub_batch_size: described_class::SUB_BATCH_SIZE + ) + end + end + + describe '#down' do + it 'deletes all batched migration records' do + migrate! + schema_migrate_down! + + expect(migration).not_to have_scheduled_batched_migration + end + end +end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 948e16a9b3c..960bde3ec93 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1345,13 +1345,12 @@ RSpec.describe Ci::Build do subject { build.send(event) } - where(:ff_enabled, :state, :report_count, :trait) do - true | :success! | 1 | :sast - true | :cancel! | 1 | :sast - true | :drop! | 2 | :multiple_report_artifacts - true | :success! | 0 | :allowed_to_fail - true | :skip! | 0 | :pending - false | :success! | 0 | :sast + where(:state, :report_count, :trait) do + :success! | 1 | :sast + :cancel! | 1 | :sast + :drop! | 2 | :multiple_report_artifacts + :success! | 0 | :allowed_to_fail + :skip! | 0 | :pending end with_them do @@ -1361,7 +1360,6 @@ RSpec.describe Ci::Build do context "when transitioning to #{params[:state]}" do before do allow(Gitlab).to receive(:com?).and_return(true) - stub_feature_flags(report_artifact_build_completed_metrics_on_build_completion: ff_enabled) end it 'increments build_completed_report_type metric' do diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index b996bf84529..f31edb747bd 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -48,82 +48,86 @@ RSpec.describe Ci::JobArtifact do end end - describe '.test_reports' do - subject { described_class.test_reports } + describe '.of_report_type' do + subject { described_class.of_report_type(report_type) } - context 'when there is a test report' do - let!(:artifact) { create(:ci_job_artifact, :junit) } + describe 'test_reports' do + let(:report_type) { :test } - it { is_expected.to eq([artifact]) } - end + context 'when there is a test report' do + let!(:artifact) { create(:ci_job_artifact, :junit) } - context 'when there are no test reports' do - let!(:artifact) { create(:ci_job_artifact, :archive) } + it { is_expected.to eq([artifact]) } + end - it { is_expected.to be_empty } - end - end + context 'when there are no test reports' do + let!(:artifact) { create(:ci_job_artifact, :archive) } - describe '.accessibility_reports' do - subject { described_class.accessibility_reports } - - context 'when there is an accessibility report' do - let(:artifact) { create(:ci_job_artifact, :accessibility) } - - it { is_expected.to eq([artifact]) } - end - - context 'when there are no accessibility report' do - let(:artifact) { create(:ci_job_artifact, :archive) } - - it { is_expected.to be_empty } - end - end - - describe '.coverage_reports' do - subject { described_class.coverage_reports } - - context 'when there is a coverage report' do - let!(:artifact) { create(:ci_job_artifact, :cobertura) } - - it { is_expected.to eq([artifact]) } - end - - context 'when there are no coverage reports' do - let!(:artifact) { create(:ci_job_artifact, :archive) } - - it { is_expected.to be_empty } - end - end - - describe '.codequality_reports' do - subject { described_class.codequality_reports } - - context 'when there is a codequality report' do - let!(:artifact) { create(:ci_job_artifact, :codequality) } - - it { is_expected.to eq([artifact]) } - end - - context 'when there are no codequality reports' do - let!(:artifact) { create(:ci_job_artifact, :archive) } - - it { is_expected.to be_empty } - end - end - - describe '.terraform_reports' do - context 'when there is a terraform report' do - it 'return the job artifact' do - artifact = create(:ci_job_artifact, :terraform) - - expect(described_class.terraform_reports).to eq([artifact]) + it { is_expected.to be_empty } end end - context 'when there are no terraform reports' do - it 'return the an empty array' do - expect(described_class.terraform_reports).to eq([]) + describe 'accessibility_reports' do + let(:report_type) { :accessibility } + + context 'when there is an accessibility report' do + let(:artifact) { create(:ci_job_artifact, :accessibility) } + + it { is_expected.to eq([artifact]) } + end + + context 'when there are no accessibility report' do + let(:artifact) { create(:ci_job_artifact, :archive) } + + it { is_expected.to be_empty } + end + end + + describe 'coverage_reports' do + let(:report_type) { :coverage } + + context 'when there is a coverage report' do + let!(:artifact) { create(:ci_job_artifact, :cobertura) } + + it { is_expected.to eq([artifact]) } + end + + context 'when there are no coverage reports' do + let!(:artifact) { create(:ci_job_artifact, :archive) } + + it { is_expected.to be_empty } + end + end + + describe 'codequality_reports' do + let(:report_type) { :codequality } + + context 'when there is a codequality report' do + let!(:artifact) { create(:ci_job_artifact, :codequality) } + + it { is_expected.to eq([artifact]) } + end + + context 'when there are no codequality reports' do + let!(:artifact) { create(:ci_job_artifact, :archive) } + + it { is_expected.to be_empty } + end + end + + describe 'terraform_reports' do + let(:report_type) { :terraform } + + context 'when there is a terraform report' do + let!(:artifact) { create(:ci_job_artifact, :terraform) } + + it { is_expected.to eq([artifact]) } + end + + context 'when there are no terraform reports' do + let!(:artifact) { create(:ci_job_artifact, :archive) } + + it { is_expected.to be_empty } end end end @@ -135,7 +139,7 @@ RSpec.describe Ci::JobArtifact do context 'when given an unrecognized report type' do it 'raises error' do - expect { described_class.file_types_for_report(:blah) }.to raise_error(KeyError, /blah/) + expect { described_class.file_types_for_report(:blah) }.to raise_error(ArgumentError, "Unrecognized report type: blah") end end end @@ -146,8 +150,8 @@ RSpec.describe Ci::JobArtifact do subject { Ci::JobArtifact.associated_file_types_for(file_type) } where(:file_type, :result) do - 'codequality' | %w(codequality) - 'quality' | nil + 'codequality' | %w(codequality) + 'quality' | nil end with_them do diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 0c28c99c113..e713d0dc068 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -686,7 +686,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do describe '.with_reports' do context 'when pipeline has a test report' do - subject { described_class.with_reports(Ci::JobArtifact.test_reports) } + subject { described_class.with_reports(Ci::JobArtifact.of_report_type(:test)) } let!(:pipeline_with_report) { create(:ci_pipeline, :with_test_reports) } @@ -696,7 +696,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do end context 'when pipeline has a coverage report' do - subject { described_class.with_reports(Ci::JobArtifact.coverage_reports) } + subject { described_class.with_reports(Ci::JobArtifact.of_report_type(:coverage)) } let!(:pipeline_with_report) { create(:ci_pipeline, :with_coverage_reports) } @@ -706,7 +706,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do end context 'when pipeline has an accessibility report' do - subject { described_class.with_reports(Ci::JobArtifact.accessibility_reports) } + subject { described_class.with_reports(Ci::JobArtifact.of_report_type(:accessibility)) } let(:pipeline_with_report) { create(:ci_pipeline, :with_accessibility_reports) } @@ -716,7 +716,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do end context 'when pipeline has a codequality report' do - subject { described_class.with_reports(Ci::JobArtifact.codequality_reports) } + subject { described_class.with_reports(Ci::JobArtifact.of_report_type(:codequality)) } let(:pipeline_with_report) { create(:ci_pipeline, :with_codequality_reports) } @@ -729,14 +729,14 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do it 'selects the pipeline' do pipeline_with_report = create(:ci_pipeline, :with_terraform_reports) - expect(described_class.with_reports(Ci::JobArtifact.terraform_reports)).to eq( + expect(described_class.with_reports(Ci::JobArtifact.of_report_type(:terraform))).to eq( [pipeline_with_report] ) end end context 'when pipeline does not have metrics reports' do - subject { described_class.with_reports(Ci::JobArtifact.test_reports) } + subject { described_class.with_reports(Ci::JobArtifact.of_report_type(:test)) } let!(:pipeline_without_report) { create(:ci_empty_pipeline) } @@ -4158,7 +4158,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do test_build = create(:ci_build, :test_reports, pipeline: pipeline) create(:ci_build, :coverage_reports, pipeline: pipeline) - expect(pipeline.latest_report_builds(Ci::JobArtifact.test_reports)).to contain_exactly(test_build) + expect(pipeline.latest_report_builds(Ci::JobArtifact.of_report_type(:test))).to contain_exactly(test_build) end it 'only returns not retried builds' do @@ -4186,7 +4186,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do create(:ci_build, :test_reports, pipeline: pipeline) grandchild_build = create(:ci_build, :codequality_reports, pipeline: grandchild_pipeline) - expect(pipeline.latest_report_builds_in_self_and_descendants(Ci::JobArtifact.codequality_reports)).to contain_exactly(grandchild_build) + expect(pipeline.latest_report_builds_in_self_and_descendants(Ci::JobArtifact.of_report_type(:codequality))).to contain_exactly(grandchild_build) end it 'only returns builds that are not retried' do @@ -4198,7 +4198,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do end describe '#has_reports?' do - subject { pipeline.has_reports?(Ci::JobArtifact.test_reports) } + subject { pipeline.has_reports?(Ci::JobArtifact.of_report_type(:test)) } context 'when pipeline has builds with test reports' do before do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 5b35fdd1eb9..4ca76ae7dd2 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -1782,20 +1782,4 @@ RSpec.describe Issue do end end end - - describe '#full_search' do - context 'when searching non-english terms' do - [ - 'abc 中文語', - '中文語cn', - '中文語' - ].each do |term| - it 'adds extra where clause to match partial index' do - expect(described_class.full_search(term).to_sql).to include( - "AND (issues.title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR issues.description NOT SIMILAR TO '[\\u0000-\\u218F]*')" - ) - end - end - end - end end diff --git a/spec/services/ci/pipelines/hook_service_spec.rb b/spec/services/ci/pipelines/hook_service_spec.rb index 0e1ef6afd0d..8d138a3d957 100644 --- a/spec/services/ci/pipelines/hook_service_spec.rb +++ b/spec/services/ci/pipelines/hook_service_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Ci::Pipelines::HookService do describe '#execute_hooks' do let_it_be(:namespace) { create(:namespace) } let_it_be(:project) { create(:project, :repository, namespace: namespace) } - let_it_be(:pipeline) { create(:ci_empty_pipeline, :created, project: project) } + let_it_be(:pipeline, reload: true) { create(:ci_empty_pipeline, :created, project: project) } let(:hook_enabled) { true } let!(:hook) { create(:project_hook, project: project, pipeline_events: hook_enabled) } diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index 4a1bf7dbbf9..b9d7998225b 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -356,6 +356,7 @@ RSpec.describe 'Every Sidekiq worker' do 'ObjectPool::ScheduleJoinWorker' => 3, 'ObjectStorage::BackgroundMoveWorker' => 5, 'ObjectStorage::MigrateUploadsWorker' => 3, + 'Onboarding::CreateLearnGitlabWorker' => 3, 'Packages::CleanupPackageFileWorker' => 0, 'Packages::Cleanup::ExecutePolicyWorker' => 0, 'Packages::Composer::CacheUpdateWorker' => false,