Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-08-23 21:10:34 +00:00
parent 0eb05ee0ea
commit de5fc58277
47 changed files with 714 additions and 398 deletions

View File

@ -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

View File

@ -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' }

View File

@ -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

View File

@ -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

View File

@ -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 || []

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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'

View File

@ -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.")

View File

@ -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

View File

@ -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

View File

@ -333,6 +333,8 @@
- 1
- - object_storage
- 1
- - onboarding_create_learn_gitlab
- 1
- - package_cleanup
- 1
- - package_repositories

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
d7062e116066ac922d42f43ef8ee6783d6bc3a30d6c36b4d70788ce47bba076f

View File

@ -0,0 +1 @@
ac9e478c7aaa351059d38dddf9a94eda7481a2bbcd4e9e5361fffb0c999be945

View File

@ -0,0 +1 @@
1f383c2db106880e8a909b9292023ae099e224d733c87e356c61038bc84cf702

View File

@ -0,0 +1 @@
f192ab50bed6dd03ae9c9c51c89d870ad6d2d1cbae129ed2da31fc061b9901d4

View File

@ -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]));

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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.

View File

@ -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: <br/>- Administration and troubleshooting requires Kubernetes knowledge.<br/>- 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.<br/><br/> 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).

View File

@ -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. <br>- For additional flexibility and resilience, see the [reference architecture documentation](../administration/reference_architectures/index.md).<br>- Review the [system requirements](requirements.md).<br>- 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.<br/>- Administration and troubleshooting requires Kubernetes knowledge.<br/>- 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.<br/><br/> |
| [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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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),

View File

@ -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'),

View File

@ -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 ""

View File

@ -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

View File

@ -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')
})

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) }

View File

@ -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,