From f4963c8c9bb2b6c38e9bd3016494a27c6c91e7e6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 28 Sep 2021 09:11:19 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_manual_todo.yml | 3 - .../issue_show/components/locked_warning.vue | 37 +++---- .../stylesheets/framework/dropdowns.scss | 2 +- .../stylesheets/startup/startup-dark.scss | 21 +--- .../stylesheets/startup/startup-general.scss | 21 +--- .../dashboard/projects_controller.rb | 2 +- app/finders/projects_finder.rb | 4 +- app/helpers/application_settings_helper.rb | 3 +- .../application_setting_implementation.rb | 1 + app/models/project.rb | 38 +------- app/models/user.rb | 7 +- app/presenters/group_clusterable_presenter.rb | 3 +- .../instance_clusterable_presenter.rb | 3 +- .../project_clusterable_presenter.rb | 3 +- app/services/search/global_service.rb | 2 +- .../application_settings/_ci_cd.html.haml | 7 ++ danger/specs/Dangerfile | 37 +------ .../14-2-deprecation-task-runner.yml | 2 +- .../templates/_deprecation_template.md.erb | 2 + ...ry_index_for_project_topics_on_taggings.rb | 20 ++++ db/schema_migrations/20210917134321 | 1 + db/structure.sql | 2 - doc/administration/pages/index.md | 59 ++++------- .../postgresql/replication_and_failover.md | 92 +++++++----------- doc/administration/raketasks/check.md | 15 +-- doc/api/graphql/reference/index.md | 13 +++ doc/ci/examples/deployment/index.md | 2 +- doc/ci/index.md | 2 +- doc/integration/azure.md | 2 +- doc/integration/bitbucket.md | 2 +- doc/integration/cas.md | 2 +- doc/integration/github.md | 2 +- doc/integration/gitlab.md | 2 +- doc/integration/google.md | 2 +- doc/integration/jenkins_deprecated.md | 2 +- doc/integration/oauth2_generic.md | 2 +- doc/integration/omniauth.md | 2 +- doc/integration/recaptcha.md | 2 +- doc/integration/salesforce.md | 2 +- doc/integration/saml.md | 6 +- doc/integration/slash_commands.md | 2 +- doc/integration/twitter.md | 2 +- doc/update/deprecations.md | 16 +-- .../settings/continuous_integration.md | 14 +++ .../settings/img/suggest_pipeline_banner.png | Bin 0 -> 14544 bytes lib/api/entities/basic_project_details.rb | 4 +- lib/api/entities/project.rb | 4 +- locale/gitlab.pot | 6 ++ spec/features/admin/admin_settings_spec.rb | 2 + spec/lib/gitlab/import_export/all_models.yml | 3 - spec/models/project_spec.rb | 29 ------ spec/models/user_spec.rb | 3 +- .../group_clusterable_presenter_spec.rb | 6 ++ .../instance_clusterable_presenter_spec.rb | 6 ++ .../project_clusterable_presenter_spec.rb | 6 ++ 55 files changed, 231 insertions(+), 304 deletions(-) create mode 100644 db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb create mode 100644 db/schema_migrations/20210917134321 create mode 100644 doc/user/admin_area/settings/img/suggest_pipeline_banner.png diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index 8022eb7f605..80421ca6bfe 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -2591,10 +2591,7 @@ Rails/IncludeUrlHelper: - 'app/presenters/ci/pipeline_presenter.rb' - 'app/presenters/environment_presenter.rb' - 'app/presenters/gitlab/blame_presenter.rb' - - 'app/presenters/group_clusterable_presenter.rb' - - 'app/presenters/instance_clusterable_presenter.rb' - 'app/presenters/merge_request_presenter.rb' - - 'app/presenters/project_clusterable_presenter.rb' - 'app/presenters/project_presenter.rb' - 'app/presenters/prometheus_alert_presenter.rb' - 'app/presenters/release_presenter.rb' diff --git a/app/assets/javascripts/issue_show/components/locked_warning.vue b/app/assets/javascripts/issue_show/components/locked_warning.vue index f3c2a31bd5b..4b99888ae73 100644 --- a/app/assets/javascripts/issue_show/components/locked_warning.vue +++ b/app/assets/javascripts/issue_show/components/locked_warning.vue @@ -1,30 +1,33 @@ diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index b05fbfaae6c..8c2d43eeaef 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -76,6 +76,7 @@ } .dropdown-toggle, +.dropdown-menu-toggle, .confidential-merge-request-fork-group .dropdown-toggle { padding: 6px 8px 6px 10px; background-color: $white; @@ -131,7 +132,6 @@ // This is double classed to solve a specificity issue with the gitlab ui buttons .dropdown-menu-toggle.dropdown-menu-toggle { - @extend .dropdown-toggle; justify-content: flex-start; overflow: hidden; padding-right: 25px; diff --git a/app/assets/stylesheets/startup/startup-dark.scss b/app/assets/stylesheets/startup/startup-dark.scss index b7958cdf4a3..50baa91b326 100644 --- a/app/assets/stylesheets/startup/startup-dark.scss +++ b/app/assets/stylesheets/startup/startup-dark.scss @@ -198,22 +198,6 @@ h1 { .dropdown { position: relative; } -.dropdown-menu-toggle { - white-space: nowrap; -} -.dropdown-menu-toggle::after { - display: inline-block; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0.3em solid; - border-right: 0.3em solid transparent; - border-bottom: 0; - border-left: 0.3em solid transparent; -} -.dropdown-menu-toggle:empty::after { - margin-left: 0; -} .dropdown-menu { position: absolute; top: 100%; @@ -466,9 +450,6 @@ a { .hide { display: none; } -.dropdown-menu-toggle::after { - display: none; -} .badge:not(.gl-badge) { padding: 4px 5px; font-size: 12px; @@ -548,7 +529,7 @@ body { border-radius: 0.25rem; white-space: nowrap; } -.no-outline.dropdown-menu-toggle { +.dropdown-menu-toggle.no-outline { outline: 0; } .dropdown-menu-toggle.dropdown-menu-toggle { diff --git a/app/assets/stylesheets/startup/startup-general.scss b/app/assets/stylesheets/startup/startup-general.scss index 2c79b819899..e4ab6a05ff5 100644 --- a/app/assets/stylesheets/startup/startup-general.scss +++ b/app/assets/stylesheets/startup/startup-general.scss @@ -178,22 +178,6 @@ h1 { .dropdown { position: relative; } -.dropdown-menu-toggle { - white-space: nowrap; -} -.dropdown-menu-toggle::after { - display: inline-block; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0.3em solid; - border-right: 0.3em solid transparent; - border-bottom: 0; - border-left: 0.3em solid transparent; -} -.dropdown-menu-toggle:empty::after { - margin-left: 0; -} .dropdown-menu { position: absolute; top: 100%; @@ -446,9 +430,6 @@ a { .hide { display: none; } -.dropdown-menu-toggle::after { - display: none; -} .badge:not(.gl-badge) { padding: 4px 5px; font-size: 12px; @@ -528,7 +509,7 @@ body { border-radius: 0.25rem; white-space: nowrap; } -.no-outline.dropdown-menu-toggle { +.dropdown-menu-toggle.no-outline { outline: 0; } .dropdown-menu-toggle.dropdown-menu-toggle { diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 74ad78ff4c1..d861ef646f8 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -36,7 +36,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def starred @projects = load_projects(params.merge(starred: true)) - .includes(:forked_from_project, :topics, :topics_acts_as_taggable) + .includes(:forked_from_project, :topics) @groups = [] diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index 5537058cc79..7245bb36ac9 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -182,8 +182,8 @@ class ProjectsFinder < UnionFinder def by_topics(items) return items unless params[:topic].present? - topics = params[:topic].instance_of?(String) ? params[:topic].strip.split(/\s*,\s*/) : params[:topic] - topics.each do |topic| + topics = params[:topic].instance_of?(String) ? params[:topic].split(',') : params[:topic] + topics.map(&:strip).uniq.reject(&:empty?).each do |topic| items = items.with_topic(topic) end diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index c0bb5eba871..6f3114e1b83 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -400,7 +400,8 @@ module ApplicationSettingsHelper :user_deactivation_emails_enabled, :sidekiq_job_limiter_mode, :sidekiq_job_limiter_compression_threshold_bytes, - :sidekiq_job_limiter_limit_bytes + :sidekiq_job_limiter_limit_bytes, + :suggest_pipeline_enabled ].tap do |settings| settings << :deactivate_dormant_users unless Gitlab.com? end diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index 612fda158d3..7859a8d62cb 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -159,6 +159,7 @@ module ApplicationSettingImplementation spam_check_endpoint_enabled: false, spam_check_endpoint_url: nil, spam_check_api_key: nil, + suggest_pipeline_enabled: true, terminal_max_session_time: 0, throttle_authenticated_api_enabled: false, throttle_authenticated_api_period_in_seconds: 3600, diff --git a/app/models/project.rb b/app/models/project.rb index 5cc5d31d4ec..a05a21b6807 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -128,26 +128,9 @@ class Project < ApplicationRecord after_initialize :use_hashed_storage after_create :check_repository_absence! - # Required during the `ActsAsTaggableOn::Tag -> Topic` migration - # TODO: remove 'acts_as_ordered_taggable_on' and ':topics_acts_as_taggable' in the further process of the migration - # https://gitlab.com/gitlab-org/gitlab/-/issues/335946 - acts_as_ordered_taggable_on :topics - has_many :topics_acts_as_taggable, -> { order("#{ActsAsTaggableOn::Tagging.table_name}.id") }, - class_name: 'ActsAsTaggableOn::Tag', - through: :topic_taggings, - source: :tag - has_many :project_topics, -> { order(:id) }, class_name: 'Projects::ProjectTopic' has_many :topics, through: :project_topics, class_name: 'Projects::Topic' - # Required during the `ActsAsTaggableOn::Tag -> Topic` migration - # TODO: remove 'topics' in the further process of the migration - # https://gitlab.com/gitlab-org/gitlab/-/issues/335946 - alias_method :topics_new, :topics - def topics - self.topics_acts_as_taggable + self.topics_new - end - attr_accessor :old_path_with_namespace attr_accessor :template_name attr_writer :pipeline_status @@ -653,15 +636,8 @@ class Project < ApplicationRecord scope :with_topic, ->(topic_name) do topic = Projects::Topic.find_by_name(topic_name) - acts_as_taggable_on_topic = ActsAsTaggableOn::Tag.find_by_name(topic_name) - return none unless topic || acts_as_taggable_on_topic - - relations = [] - relations << where(id: topic.project_topics.select(:project_id)) if topic - relations << where(id: acts_as_taggable_on_topic.taggings.select(:taggable_id)) if acts_as_taggable_on_topic - - Project.from_union(relations) + topic ? where(id: topic.project_topics.select(:project_id)) : none end enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 } @@ -679,7 +655,7 @@ class Project < ApplicationRecord mount_uploader :bfg_object_map, AttachmentUploader def self.with_api_entity_associations - preload(:project_feature, :route, :topics, :topics_acts_as_taggable, :group, :timelogs, namespace: [:route, :owner]) + preload(:project_feature, :route, :topics, :group, :timelogs, namespace: [:route, :owner]) end def self.with_web_entity_associations @@ -2735,15 +2711,9 @@ class Project < ApplicationRecord @topic_list = @topic_list.split(',') if @topic_list.instance_of?(String) @topic_list = @topic_list.map(&:strip).uniq.reject(&:empty?) - if @topic_list != self.topic_list || self.topics_acts_as_taggable.any? - self.topics_new.delete_all + if @topic_list != self.topic_list + self.topics.delete_all self.topics = @topic_list.map { |topic| Projects::Topic.find_or_create_by(name: topic) } - - # Remove old topics (ActsAsTaggableOn::Tag) - # Required during the `ActsAsTaggableOn::Tag -> Topic` migration - # TODO: remove in the further process of the migration - # https://gitlab.com/gitlab-org/gitlab/-/issues/335946 - self.topic_taggings.clear end @topic_list = nil diff --git a/app/models/user.rb b/app/models/user.rb index 03347ee3a40..8b64160e6fc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -455,7 +455,7 @@ class User < ApplicationRecord def preferred_language read_attribute('preferred_language') || I18n.default_locale.to_s.presence_in(Gitlab::I18n.available_locales) || - 'en' + default_preferred_language end def active_for_authentication? @@ -2004,6 +2004,11 @@ class User < ApplicationRecord private + # To enable JiHu repository to modify the default language options + def default_preferred_language + 'en' + end + def notification_email_verified return if notification_email.blank? || temp_oauth_email? diff --git a/app/presenters/group_clusterable_presenter.rb b/app/presenters/group_clusterable_presenter.rb index 207767af245..c51cd415029 100644 --- a/app/presenters/group_clusterable_presenter.rb +++ b/app/presenters/group_clusterable_presenter.rb @@ -2,7 +2,6 @@ class GroupClusterablePresenter < ClusterablePresenter extend ::Gitlab::Utils::Override - include ActionView::Helpers::UrlHelper presents ::Group @@ -33,7 +32,7 @@ class GroupClusterablePresenter < ClusterablePresenter override :learn_more_link def learn_more_link - link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer') + ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/group/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end def metrics_dashboard_path(cluster) diff --git a/app/presenters/instance_clusterable_presenter.rb b/app/presenters/instance_clusterable_presenter.rb index 77ca171156d..f2550eb17e3 100644 --- a/app/presenters/instance_clusterable_presenter.rb +++ b/app/presenters/instance_clusterable_presenter.rb @@ -2,7 +2,6 @@ class InstanceClusterablePresenter < ClusterablePresenter extend ::Gitlab::Utils::Override - include ActionView::Helpers::UrlHelper presents ::Clusters::Instance @@ -71,7 +70,7 @@ class InstanceClusterablePresenter < ClusterablePresenter override :learn_more_link def learn_more_link - link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer') + ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about instance Kubernetes clusters'), help_page_path('user/instance/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end def metrics_dashboard_path(cluster) diff --git a/app/presenters/project_clusterable_presenter.rb b/app/presenters/project_clusterable_presenter.rb index 05344f2da96..6c4d1143c0f 100644 --- a/app/presenters/project_clusterable_presenter.rb +++ b/app/presenters/project_clusterable_presenter.rb @@ -2,7 +2,6 @@ class ProjectClusterablePresenter < ClusterablePresenter extend ::Gitlab::Utils::Override - include ActionView::Helpers::UrlHelper presents ::Project @@ -28,7 +27,7 @@ class ProjectClusterablePresenter < ClusterablePresenter override :learn_more_link def learn_more_link - link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') + ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') end def metrics_dashboard_path(cluster) diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb index 33faf2d6698..cee59360b4b 100644 --- a/app/services/search/global_service.rb +++ b/app/services/search/global_service.rb @@ -24,7 +24,7 @@ module Search # rubocop: disable CodeReuse/ActiveRecord def projects - @projects ||= ProjectsFinder.new(params: { non_archived: true }, current_user: current_user).execute.preload(:topics, :taggings) + @projects ||= ProjectsFinder.new(params: { non_archived: true }, current_user: current_user).execute.preload(:topics, :project_topics) end def allowed_scopes diff --git a/app/views/admin/application_settings/_ci_cd.html.haml b/app/views/admin/application_settings/_ci_cd.html.haml index fea116bd419..8026ec4702b 100644 --- a/app/views/admin/application_settings/_ci_cd.html.haml +++ b/app/views/admin/application_settings/_ci_cd.html.haml @@ -69,5 +69,12 @@ %p.form-text.text-muted = _("The default CI/CD configuration file and path for new projects.").html_safe = link_to sprite_icon('question-o'), help_page_path('ci/pipelines/settings', anchor: 'specify-a-custom-cicd-configuration-file'), target: '_blank' + .form-group + .form-check + = f.check_box :suggest_pipeline_enabled, class: 'form-check-input' + = f.label :suggest_pipeline_enabled, class: 'form-check-label' do + = s_('AdminSettings|Enable pipeline suggestion banner') + .form-text.text-muted + = s_('AdminSettings|Display a banner on merge requests in projects with no pipelines to initiate steps to add a .gitlab-ci.yml file.') = f.submit _('Save changes'), class: "gl-button btn btn-confirm" diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index df4e324a4c8..35476ae645d 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -32,22 +32,11 @@ request specs (and/or feature specs). Please add request specs under See https://gitlab.com/groups/gitlab-org/-/epics/5076 for information. MSG -MATCH_WITH_ARRAY_REGEX = /(?match|eq)(?[( ]?\[)/.freeze - -SUGGEST_MR_COMMENT = <<~SUGGEST_COMMENT -```suggestion -%s - -If order of the result is not important, please consider using `match_array` to avoid flakiness. -``` -SUGGEST_COMMENT - -all_changed_files = helper.all_changed_files -has_app_changes = all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? -has_ee_app_changes = all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? -spec_changes = all_changed_files.grep(%r{\Aspec/}) +has_app_changes = helper.all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? +has_ee_app_changes = helper.all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? +spec_changes = helper.all_changed_files.grep(%r{\Aspec/}) has_spec_changes = spec_changes.any? -has_ee_spec_changes = all_changed_files.grep(%r{\Aee/spec/}).any? +has_ee_spec_changes = helper.all_changed_files.grep(%r{\Aee/spec/}).any? new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty? if (has_app_changes || has_ee_app_changes) && !(has_spec_changes || has_ee_spec_changes) && new_specs_needed @@ -60,22 +49,6 @@ if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_ch end # Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers` -if project_helper.changes.added.files.grep(%r{^(ee/)?spec/controllers/}).any? +if git.added_files.grep(%r{^(ee/)?spec/controllers/}).any? warn CONTROLLER_SPEC_DEPRECATION_MESSAGE end - -def check_for_match_with_array! - (project_helper.changes.added.files + project_helper.changes.modified.files + project_helper.changes.renamed_after.files).grep(%r{\A(ee/)?spec/}).each do |filename| - added_lines = helper.changed_lines(filename).grep(/\A\+ /) - next unless added_lines.any? { |line| line =~ MATCH_WITH_ARRAY_REGEX } - - spec_file_lines = File.read(filename).lines(chomp: true) - - added_lines.each do |added_line| - mr_line = spec_file_lines.find_index(added_line.delete_prefix('+')) - markdown(format(SUGGEST_MR_COMMENT, suggested_line: spec_file_lines[mr_line].gsub(MATCH_WITH_ARRAY_REGEX, 'match_array\k')), file: filename, line: mr_line.succ) - end - end -end - -check_for_match_with_array! diff --git a/data/deprecations/14-2-deprecation-task-runner.yml b/data/deprecations/14-2-deprecation-task-runner.yml index 963d978a568..4d01a1969ad 100644 --- a/data/deprecations/14-2-deprecation-task-runner.yml +++ b/data/deprecations/14-2-deprecation-task-runner.yml @@ -5,7 +5,7 @@ body: | # Do not modify this line, instead modify the lines below. The Task Runner pod is used to execute periodic housekeeping tasks within the GitLab application and is often confused with the GitLab Runner. Thus, [Task Runner will be renamed to Toolbox](https://gitlab.com/groups/gitlab-org/charts/-/epics/25). - This will result in the rename of the sub-chart: `gitlab/task-runner` to `gitlab/toolbox`. Resulting pods will be named along the lines of `{{ .Release.Name }}-toolbox`, which will often be `gitlab-toolbox`. They will be locatable with the label `app=toolbox`. + This will result in the rename of the sub-chart: `gitlab/task-runner` to `gitlab/toolbox`. Resulting pods will be named along the lines of `{{ .Release.Name }}-toolbox`, which will often be `gitlab-toolbox`. They will be locatable with the label `app=toolbox`. stage: # (optional - may be required in the future) String value of the stage that the feature was created in. e.g., Growth tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate] diff --git a/data/deprecations/templates/_deprecation_template.md.erb b/data/deprecations/templates/_deprecation_template.md.erb index 64bd6a75a5e..5721badff36 100644 --- a/data/deprecations/templates/_deprecation_template.md.erb +++ b/data/deprecations/templates/_deprecation_template.md.erb @@ -6,6 +6,8 @@ info: "See the Technical Writers assigned to Development Guidelines: https://abo # Deprecated feature removal schedule + + +