From ab7ca19e6844c37a715e378801409e297fd51512 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 6 Sep 2021 12:11:14 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/rails.gitlab-ci.yml | 2 +- .gitlab/ci/setup.gitlab-ci.yml | 1 - GITALY_SERVER_VERSION | 2 +- .../design_management/pages/index.vue | 3 + .../{learn_gitlab_a.vue => learn_gitlab.vue} | 0 .../components/learn_gitlab_section_link.vue | 2 +- .../projects/learn_gitlab/index/index.js | 4 +- .../javascripts/projects/project_new.js | 22 +++-- .../markdown/suggestion_diff_header.vue | 3 +- .../labels_select_vue/labels_select_root.vue | 2 + .../cycle_analytics/summary_controller.rb | 2 +- .../registrations/welcome_controller.rb | 2 +- .../combined_registration_experiment.rb | 19 +++++ app/models/ci/build.rb | 4 +- app/models/project.rb | 3 + app/services/ci/pipelines/add_job_service.rb | 4 +- app/services/ci/update_build_queue_service.rb | 14 ++-- app/services/projects/create_service.rb | 12 ++- .../projects/_new_project_fields.html.haml | 2 +- .../merge_requests/_merge_requests.html.haml | 2 +- .../projects/merge_requests/index.html.haml | 2 +- .../empty_states/_merge_requests.html.haml | 4 +- app/workers/deployments/hooks_worker.rb | 2 +- .../ci_fix_commit_status_retried.yml | 8 -- .../combined_registration.yml} | 12 +-- config/routes.rb | 3 + ...ce_merge_request_diff_commit_migrations.rb | 42 +++++----- .../documentation/site_architecture/index.md | 11 --- doc/integration/jira/connect-app.md | 13 ++- doc/user/group/saml_sso/index.md | 84 ++++++++++++++++++- doc/user/project/clusters/index.md | 5 +- lib/api/entities/application_setting.rb | 8 ++ lib/api/helpers/settings_helpers.rb | 16 +++- lib/api/settings.rb | 10 +++ .../async_indexes/migration_helpers.rb | 5 +- locale/gitlab.pot | 30 +++++++ package.json | 2 +- scripts/rspec_helpers.sh | 2 +- .../summary_controller_spec.rb | 36 +++++++- .../user_sees_empty_state_spec.rb | 21 +++++ .../design_management/pages/index_spec.js | 10 +++ ...spec.js.snap => learn_gitlab_spec.js.snap} | 16 ++-- ..._gitlab_a_spec.js => learn_gitlab_spec.js} | 6 +- .../async_indexes/migration_helpers_spec.rb | 17 ++++ spec/requests/api/commit_statuses_spec.rb | 36 ++------ spec/requests/api/settings_spec.rb | 39 +++++++++ .../update_service_spec.rb | 22 +++++ .../ci/pipelines/add_job_service_spec.rb | 12 --- spec/services/projects/create_service_spec.rb | 6 ++ .../projects/update_pages_service_spec.rb | 12 --- .../support/database/cross-join-allowlist.yml | 3 - spec/support/helpers/live_debugger.rb | 2 +- spec/workers/deployments/hooks_worker_spec.rb | 1 - tooling/bin/find_tests | 5 +- yarn.lock | 8 +- 55 files changed, 441 insertions(+), 175 deletions(-) rename app/assets/javascripts/pages/projects/learn_gitlab/components/{learn_gitlab_a.vue => learn_gitlab.vue} (100%) create mode 100644 app/experiments/combined_registration_experiment.rb delete mode 100644 config/feature_flags/development/ci_fix_commit_status_retried.yml rename config/feature_flags/{development/load_balancing_for_deployments_hooks_worker.yml => experiment/combined_registration.yml} (54%) rename spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/{learn_gitlab_a_spec.js.snap => learn_gitlab_spec.js.snap} (97%) rename spec/frontend/pages/projects/learn_gitlab/components/{learn_gitlab_a_spec.js => learn_gitlab_spec.js} (78%) diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 00f65ab7ca8..a8524470aa2 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -21,7 +21,7 @@ .minimal-rspec-tests: variables: - RSPEC_TESTS_MAPPING_ENABLED: "true" + MINIMAL_RSPEC_ENABLED: "true" .decomposed-database-rspec: variables: diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index f2d5d872d64..47bdd3b538c 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -82,7 +82,6 @@ detect-tests: - .detect-test-base - .rails:rules:detect-tests variables: - RSPEC_TESTS_MAPPING_ENABLED: "true" MATCHED_TESTS_FILE: tmp/matching_tests.txt detect-tests as-if-foss: diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index bbc1295448a..c31089553a3 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -0077763984dabc1056f34c698fc924cde5400133 +788a0f1bf74a35d9736bfccc04ab9b5c0539e932 diff --git a/app/assets/javascripts/design_management/pages/index.vue b/app/assets/javascripts/design_management/pages/index.vue index ad557f64ce4..e66ae822a34 100644 --- a/app/assets/javascripts/design_management/pages/index.vue +++ b/app/assets/javascripts/design_management/pages/index.vue @@ -140,6 +140,9 @@ export default { this.$el.scrollIntoView(); } }, + beforeDestroy() { + document.removeEventListener('paste', this.onDesignPaste); + }, methods: { resetFilesToBeSaved() { this.filesToBeSaved = []; diff --git a/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_a.vue b/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab.vue similarity index 100% rename from app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_a.vue rename to app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab.vue diff --git a/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_section_link.vue b/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_section_link.vue index 3d31ac6c267..69fb5878f5c 100644 --- a/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_section_link.vue +++ b/app/assets/javascripts/pages/projects/learn_gitlab/components/learn_gitlab_section_link.vue @@ -39,7 +39,7 @@ export default { :href="value.url" data-track-action="click_link" :data-track-label="$options.i18n.ACTION_LABELS[action].title" - data-track-property="Growth::Conversion::Experiment::LearnGitLabA" + data-track-property="Growth::Conversion::Experiment::LearnGitLab" > {{ $options.i18n.ACTION_LABELS[action].title }} diff --git a/app/assets/javascripts/pages/projects/learn_gitlab/index/index.js b/app/assets/javascripts/pages/projects/learn_gitlab/index/index.js index d7e68870d75..6da0a8fd212 100644 --- a/app/assets/javascripts/pages/projects/learn_gitlab/index/index.js +++ b/app/assets/javascripts/pages/projects/learn_gitlab/index/index.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -import LearnGitlabA from '../components/learn_gitlab_a.vue'; +import LearnGitlab from '../components/learn_gitlab.vue'; function initLearnGitlab() { const el = document.getElementById('js-learn-gitlab-app'); @@ -15,7 +15,7 @@ function initLearnGitlab() { return new Vue({ el, render(createElement) { - return createElement(LearnGitlabA, { + return createElement(LearnGitlab, { props: { actions, sections }, }); }, diff --git a/app/assets/javascripts/projects/project_new.js b/app/assets/javascripts/projects/project_new.js index ee02f446795..ebd20583a1c 100644 --- a/app/assets/javascripts/projects/project_new.js +++ b/app/assets/javascripts/projects/project_new.js @@ -71,6 +71,17 @@ const deriveProjectPathFromUrl = ($projectImportUrl) => { } }; +const bindHowToImport = () => { + $('.how_to_import_link').on('click', (e) => { + e.preventDefault(); + $(e.currentTarget).next('.modal').show(); + }); + + $('.modal-header .close').on('click', () => { + $('.modal').hide(); + }); +}; + const bindEvents = () => { const $newProjectForm = $('#new_project'); const $projectImportUrl = $('#project_import_url'); @@ -88,14 +99,7 @@ const bindEvents = () => { return; } - $('.how_to_import_link').on('click', (e) => { - e.preventDefault(); - $(e.currentTarget).next('.modal').show(); - }); - - $('.modal-header .close').on('click', () => { - $('.modal').hide(); - }); + bindHowToImport(); $('.btn_import_gitlab_project').on('click', () => { const importHref = $('a.btn_import_gitlab_project').attr('href'); @@ -174,3 +178,5 @@ export default { onProjectNameChange, onProjectPathChange, }; + +export { bindHowToImport }; diff --git a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue index 065d9b1b5dd..5fdef0b1a23 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue @@ -39,7 +39,8 @@ export default { }, defaultCommitMessage: { type: String, - required: true, + required: false, + default: null, }, inapplicableReason: { type: String, diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue index 4234bc72f3a..eeaee52ed8e 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue @@ -173,6 +173,8 @@ export default { footerManageLabelTitle: this.footerManageLabelTitle, }); + setTimeout(() => this.updateLabelsSetState(), 100); + this.$store.subscribeAction({ after: this.handleVuexActionDispatch, }); diff --git a/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb b/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb index c51a5ac7b88..bf8742bf6e8 100644 --- a/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb +++ b/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb @@ -20,7 +20,7 @@ class Projects::Analytics::CycleAnalytics::SummaryController < Projects::Applica end def allowed_params - params.permit(:created_after, :created_before) + request_params.to_data_collector_params end end diff --git a/app/controllers/registrations/welcome_controller.rb b/app/controllers/registrations/welcome_controller.rb index ced21b8f291..416bbf43464 100644 --- a/app/controllers/registrations/welcome_controller.rb +++ b/app/controllers/registrations/welcome_controller.rb @@ -16,7 +16,7 @@ module Registrations result = ::Users::SignupService.new(current_user, update_params).execute if result[:status] == :success - return redirect_to new_users_sign_up_group_path(trial_params) if show_signup_onboarding? + return redirect_to experiment(:combined_registration, user: current_user).redirect_path(trial_params) if show_signup_onboarding? members = current_user.members diff --git a/app/experiments/combined_registration_experiment.rb b/app/experiments/combined_registration_experiment.rb new file mode 100644 index 00000000000..3ba6195a62a --- /dev/null +++ b/app/experiments/combined_registration_experiment.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CombinedRegistrationExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass + include Rails.application.routes.url_helpers + + def redirect_path(trial_params) + @trial_params = trial_params + + run + end + + def control_behavior + new_users_sign_up_group_path(@trial_params) + end + + def candidate_behavior + new_users_sign_up_groups_project_path + end +end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index d7b93a616fc..eb970187c28 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -760,7 +760,9 @@ module Ci def any_runners_available? cache_for_available_runners do - project.active_runners.exists? + ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937') do + project.active_runners.exists? + end end end diff --git a/app/models/project.rb b/app/models/project.rb index 00e1ffe62b8..d8f26664781 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1784,6 +1784,9 @@ class Project < ApplicationRecord Ci::Runner.from_union([runners, group_runners, available_shared_runners]) end + # Once issue 339937 is fixed, please search for all mentioned of + # https://gitlab.com/gitlab-org/gitlab/-/issues/339937, + # and remove the allow_cross_joins_across_databases. def active_runners strong_memoize(:active_runners) do all_available_runners.active diff --git a/app/services/ci/pipelines/add_job_service.rb b/app/services/ci/pipelines/add_job_service.rb index 41f9903e48c..53536b6fdf9 100644 --- a/app/services/ci/pipelines/add_job_service.rb +++ b/app/services/ci/pipelines/add_job_service.rb @@ -21,14 +21,14 @@ module Ci Ci::Pipeline.transaction do yield(job) - job.update_older_statuses_retried! if Feature.enabled?(:ci_fix_commit_status_retried, pipeline.project, default_enabled: :yaml) + job.update_older_statuses_retried! end end else Ci::Pipeline.transaction do yield(job) - job.update_older_statuses_retried! if Feature.enabled?(:ci_fix_commit_status_retried, pipeline.project, default_enabled: :yaml) + job.update_older_statuses_retried! end end diff --git a/app/services/ci/update_build_queue_service.rb b/app/services/ci/update_build_queue_service.rb index eea09e9ac67..c1cbf031ca1 100644 --- a/app/services/ci/update_build_queue_service.rb +++ b/app/services/ci/update_build_queue_service.rb @@ -99,15 +99,17 @@ module Ci private def tick_for(build, runners) - runners = runners.with_recent_runner_queue - runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml) + ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937') do + runners = runners.with_recent_runner_queue + runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml) - metrics.observe_active_runners(-> { runners.to_a.size }) + metrics.observe_active_runners(-> { runners.to_a.size }) - runners.each do |runner| - metrics.increment_runner_tick(runner) + runners.each do |runner| + metrics.increment_runner_tick(runner) - runner.pick_build!(build) + runner.pick_build!(build) + end end end diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 5bc0d7551ee..e717491b19d 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -90,10 +90,14 @@ module Projects def after_create_actions log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"") - # Skip writing the config for project imports/forks because it - # will always fail since the Git directory doesn't exist until - # a background job creates it (see Project#add_import_job). - @project.set_full_path unless @project.import? + if @project.import? + experiment(:combined_registration, user: current_user).track(:import_project) + else + # Skip writing the config for project imports/forks because it + # will always fail since the Git directory doesn't exist until + # a background job creates it (see Project#add_import_job). + @project.set_full_path + end unless @project.gitlab_project_import? @project.create_wiki unless skip_wiki? diff --git a/app/views/projects/_new_project_fields.html.haml b/app/views/projects/_new_project_fields.html.haml index fd25d8609d0..0dc71ecb50e 100644 --- a/app/views/projects/_new_project_fields.html.haml +++ b/app/views/projects/_new_project_fields.html.haml @@ -8,7 +8,7 @@ .form-group.project-name.col-sm-12 = f.label :name, class: 'label-bold' do %span= _("Project name") - = f.text_field :name, placeholder: "My awesome project", class: "form-control gl-form-input input-lg", autofocus: true, data: { track_label: "#{track_label}", track_event: "activate_form_input", track_property: "project_name", track_value: "" }, required: true, aria: { required: true } + = f.text_field :name, placeholder: "My awesome project", class: "form-control gl-form-input input-lg", data: { track_label: "#{track_label}", track_event: "activate_form_input", track_property: "project_name", track_value: "" }, required: true, aria: { required: true } .form-group.project-path.col-sm-6 = f.label :namespace_id, class: 'label-bold' do %span= _('Project URL') diff --git a/app/views/projects/merge_requests/_merge_requests.html.haml b/app/views/projects/merge_requests/_merge_requests.html.haml index e2123e36e67..0abbf953fc7 100644 --- a/app/views/projects/merge_requests/_merge_requests.html.haml +++ b/app/views/projects/merge_requests/_merge_requests.html.haml @@ -2,7 +2,7 @@ - if @merge_requests.present? = render @merge_requests - else - = render 'shared/empty_states/merge_requests' + = render 'shared/empty_states/merge_requests', button_path: new_merge_request_path - if @merge_requests.present? = paginate_collection @merge_requests, total_pages: @total_pages diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index 7caa62c9fb9..41c6696789d 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -23,7 +23,7 @@ = render 'shared/issuable/bulk_update_sidebar', type: :merge_requests .merge-requests-holder - = render 'merge_requests' + = render 'merge_requests', new_merge_request_path: new_merge_request_path - if new_merge_request_email .gl-text-center.gl-pt-5.gl-pb-7 .js-issueable-by-email{ data: { initial_email: new_merge_request_email, issuable_type: issuable_type, emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'), quick_actions_help_path: help_page_path('user/project/quick_actions'), markdown_help_path: help_page_path('user/markdown'), reset_path: new_issuable_address_project_path(@project, issuable_type: issuable_type) } } diff --git a/app/views/shared/empty_states/_merge_requests.html.haml b/app/views/shared/empty_states/_merge_requests.html.haml index 879447f16ae..72db4d4c846 100644 --- a/app/views/shared/empty_states/_merge_requests.html.haml +++ b/app/views/shared/empty_states/_merge_requests.html.haml @@ -20,7 +20,7 @@ = _("To widen your search, change or remove filters above") .text-center - if can_create_merge_request - = link_to _("New merge request"), project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request") + = link_to _("New merge request"), button_path || project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request") - elsif is_opened_state && opened_merged_count == 0 && closed_merged_count > 0 %h4.text-center = _("There are no open merge requests") @@ -28,7 +28,7 @@ = _("To keep this project going, create a new merge request") .text-center - if can_create_merge_request - = link_to _("New merge request"), project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request") + = link_to _("New merge request"), button_path || project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request") - elsif is_closed_state && opened_merged_count > 0 && closed_merged_count == 0 %h4.text-center = _("There are no closed merge requests") diff --git a/app/workers/deployments/hooks_worker.rb b/app/workers/deployments/hooks_worker.rb index d23a440ed36..31c57e5c001 100644 --- a/app/workers/deployments/hooks_worker.rb +++ b/app/workers/deployments/hooks_worker.rb @@ -4,7 +4,7 @@ module Deployments class HooksWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - data_consistency :delayed, feature_flag: :load_balancing_for_deployments_hooks_worker + data_consistency :delayed queue_namespace :deployment feature_category :continuous_delivery diff --git a/config/feature_flags/development/ci_fix_commit_status_retried.yml b/config/feature_flags/development/ci_fix_commit_status_retried.yml deleted file mode 100644 index 56400c861cd..00000000000 --- a/config/feature_flags/development/ci_fix_commit_status_retried.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ci_fix_commit_status_retried -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54300 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/321631 -milestone: '13.9' -type: development -group: group::pipeline authoring -default_enabled: true diff --git a/config/feature_flags/development/load_balancing_for_deployments_hooks_worker.yml b/config/feature_flags/experiment/combined_registration.yml similarity index 54% rename from config/feature_flags/development/load_balancing_for_deployments_hooks_worker.yml rename to config/feature_flags/experiment/combined_registration.yml index fe6dbca3dd4..1be740c7141 100644 --- a/config/feature_flags/development/load_balancing_for_deployments_hooks_worker.yml +++ b/config/feature_flags/experiment/combined_registration.yml @@ -1,8 +1,8 @@ --- -name: load_balancing_for_deployments_hooks_worker -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67878 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338342 -milestone: '14.2' -type: development -group: group::release +name: combined_registration +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67614 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285533 +milestone: '14.3' +type: experiment +group: group::adoption default_enabled: false diff --git a/config/routes.rb b/config/routes.rb index 892980422a3..c5f91ee4020 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -68,6 +68,9 @@ Rails.application.routes.draw do Gitlab.ee do resources :groups, only: [:new, :create] resources :projects, only: [:new, :create] + resources :groups_projects, only: [:new, :create] do + post :import, on: :collection + end end end diff --git a/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb b/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb index 0f317ff26f2..8ee7feae1a6 100644 --- a/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb +++ b/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb @@ -3,6 +3,8 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1] include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + BATCH_SIZE = 5_000 MIGRATION_CLASS = 'MigrateMergeRequestDiffCommitUsers' STEAL_MIGRATION_CLASS = 'StealMigrateMergeRequestDiffCommitUsers' @@ -15,31 +17,33 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1] return if old_jobs.empty? - # This ensures we stop processing the old ranges, as the background - # migrations skip already processed jobs. - Gitlab::Database::BackgroundMigrationJob - .for_migration_class(MIGRATION_CLASS) - .pending - .update_all(status: :succeeded) + transaction do + # This ensures we stop processing the old ranges, as the background + # migrations skip already processed jobs. + Gitlab::Database::BackgroundMigrationJob + .for_migration_class(MIGRATION_CLASS) + .pending + .update_all(status: :succeeded) - rows = [] + rows = [] - old_jobs.each do |job| - min, max = job.arguments + old_jobs.each do |job| + min, max = job.arguments - while min < max - rows << { - class_name: MIGRATION_CLASS, - arguments: [min, min + BATCH_SIZE], - created_at: Time.now.utc, - updated_at: Time.now.utc - } + while min < max + rows << { + class_name: MIGRATION_CLASS, + arguments: [min, min + BATCH_SIZE], + created_at: Time.now.utc, + updated_at: Time.now.utc + } - min += BATCH_SIZE + min += BATCH_SIZE + end end - end - Gitlab::Database::BackgroundMigrationJob.insert_all!(rows) + Gitlab::Database::BackgroundMigrationJob.insert_all!(rows) + end job = Gitlab::Database::BackgroundMigrationJob .for_migration_class(MIGRATION_CLASS) diff --git a/doc/development/documentation/site_architecture/index.md b/doc/development/documentation/site_architecture/index.md index 046de5c6d86..cd69154217c 100644 --- a/doc/development/documentation/site_architecture/index.md +++ b/doc/development/documentation/site_architecture/index.md @@ -33,7 +33,6 @@ from where content is sourced, the `gitlab-docs` project, and the published outp D --> E E -- Build pipeline --> F F[docs.gitlab.com] - G[/ce/] H[/ee/] I[/runner/] J[/omnibus/] @@ -42,7 +41,6 @@ from where content is sourced, the `gitlab-docs` project, and the published outp F --> I F --> J F --> K - H -- symlink --> G ``` GitLab docs content isn't kept in the `gitlab-docs` repository. @@ -54,15 +52,6 @@ product, and all together are pulled to generate the docs website: - [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner/-/tree/main/docs) - [GitLab Chart](https://gitlab.com/charts/gitlab/tree/master/doc) -NOTE: -In September 2019, we [moved towards a single codebase](https://gitlab.com/gitlab-org/gitlab/-/issues/2952), -as such the docs for CE and EE are now identical. For historical reasons and -in order not to break any existing links throughout the internet, we still -maintain the CE docs (`https://docs.gitlab.com/ce/`), although it is hidden -from the website, and is now a symlink to the EE docs. When -[Support wildcard redirects](https://gitlab.com/gitlab-org/gitlab-pages/-/issues/500) is resolved, -we can remove this completely. - ## Assets To provide an optimized site structure, design, and a search-engine friendly diff --git a/doc/integration/jira/connect-app.md b/doc/integration/jira/connect-app.md index 33725c289eb..42ec2456c2d 100644 --- a/doc/integration/jira/connect-app.md +++ b/doc/integration/jira/connect-app.md @@ -60,6 +60,14 @@ After a namespace is added: Support for syncing past branch and commit data is tracked [in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/263240). +## Update the GitLab.com for Jira Cloud app + +Most updates to the app are fully automated and don't require any user interaction. See the +[Atlassian Marketplace documentation](https://developer.atlassian.com/platform/marketplace/upgrading-and-versioning-cloud-apps/) +for details. + +If the app requires additional permissions, [the update must first be manually approved in Jira](https://developer.atlassian.com/platform/marketplace/upgrading-and-versioning-cloud-apps/#changes-that-require-manual-customer-approval). + ## Install the GitLab.com for Jira Cloud app for self-managed instances **(FREE SELF)** If your GitLab instance is self-managed, you must follow some @@ -103,7 +111,7 @@ The **GitLab.com for Jira Cloud** app now displays under **Manage apps**. You ca click **Get started** to open the configuration page rendered from your GitLab instance. NOTE: -If you make changes to the application descriptor, you must uninstall, then reinstall, the +If a GitLab update makes changes to the application descriptor, you must uninstall, then reinstall, the application. ### Create a Marketplace listing **(FREE SELF)** @@ -127,7 +135,8 @@ Review the for details. NOTE: -DVCS means distributed version control system. +Using this method, [updates are automated](#update-the-gitlabcom-for-jira-cloud-app) +the same way as when using our GitLab.com Marketplace listing. ## Troubleshoot GitLab.com for Jira Cloud app diff --git a/doc/user/group/saml_sso/index.md b/doc/user/group/saml_sso/index.md index 0c4519c8d36..ac06de14481 100644 --- a/doc/user/group/saml_sso/index.md +++ b/doc/user/group/saml_sso/index.md @@ -356,10 +356,88 @@ the user gets the highest access level from the groups. For example, if one grou is linked as `Guest` and another `Maintainer`, a user in both groups gets `Maintainer` access. -Users who are not members of any mapped SAML groups are removed from the GitLab group. +### Automatic member removal -You can prevent accidental member removal. For example, if you have a SAML group link for `Owner` level access -in a top-level group, you should also set up a group link for all other members. +After a group sync, users who are not members of a mapped SAML group are removed from +the GitLab group. + +For example, in the following diagram: + +- Alex Garcia signs into GitLab and is removed from GitLab Group C because they don't belong + to SAML Group C. +- Sidney Jones belongs to SAML Group C, but is not added to GitLab Group C because they have + not yet signed in. + +```mermaid +graph TB + subgraph SAML users + SAMLUserA[Sidney Jones] + SAMLUserB[Zhang Wei] + SAMLUserC[Alex Garcia] + SAMLUserD[Charlie Smith] + end + + subgraph SAML groups + SAMLGroupA["Group A"] --> SAMLGroupB["Group B"] + SAMLGroupA --> SAMLGroupC["Group C"] + SAMLGroupA --> SAMLGroupD["Group D"] + end + + SAMLGroupB --> |Member|SAMLUserA + SAMLGroupB --> |Member|SAMLUserB + + SAMLGroupC --> |Member|SAMLUserA + SAMLGroupC --> |Member|SAMLUserB + + SAMLGroupD --> |Member|SAMLUserD + SAMLGroupD --> |Member|SAMLUserC +``` + +```mermaid +graph TB + subgraph GitLab users + GitLabUserA[Sidney Jones] + GitLabUserB[Zhang Wei] + GitLabUserC[Alex Garcia] + GitLabUserD[Charlie Smith] + end + + subgraph GitLab groups + GitLabGroupA["Group A (SAML configured)"] --> GitLabGroupB["Group B (SAML Group Link not configured)"] + GitLabGroupA --> GitLabGroupC["Group C (SAML Group Link configured)"] + GitLabGroupA --> GitLabGroupD["Group D (SAML Group Link configured)"] + end + + GitLabGroupB --> |Member|GitLabUserA + + GitLabGroupC --> |Member|GitLabUserB + GitLabGroupC --> |Member|GitLabUserC + + GitLabGroupD --> |Member|GitLabUserC + GitLabGroupD --> |Member|GitLabUserD +``` + +```mermaid +graph TB + subgraph GitLab users + GitLabUserA[Sidney Jones] + GitLabUserB[Zhang Wei] + GitLabUserC[Alex Garcia] + GitLabUserD[Charlie Smith] + end + + subgraph GitLab groups after Alex Garcia signs in + GitLabGroupA[Group A] + GitLabGroupA["Group A (SAML configured)"] --> GitLabGroupB["Group B (SAML Group Link not configured)"] + GitLabGroupA --> GitLabGroupC["Group C (SAML Group Link configured)"] + GitLabGroupA --> GitLabGroupD["Group D (SAML Group Link configured)"] + end + + GitLabGroupB --> |Member|GitLabUserA + GitLabGroupC --> |Member|GitLabUserB + GitLabGroupD --> |Member|GitLabUserC + GitLabGroupD --> |Member|GitLabUserD +``` ## Passwords for users created via SAML SSO for Groups diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 73a9abdfbd9..ed24172e141 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -66,9 +66,8 @@ You can use [cluster certificates](add_existing_cluster.md) to connect clusters in all levels (projects, group, instance). However, for [security implications](#security-implications), this method is no longer recommended. -### Methods to create new clusters - -To create new clusters, we **recommend** using [Infrastructure as Code](../../infrastructure/index.md). +To create new clusters, we **recommend** using +[Infrastructure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac). ### Cluster levels diff --git a/lib/api/entities/application_setting.rb b/lib/api/entities/application_setting.rb index f23fce40468..465c5f4112b 100644 --- a/lib/api/entities/application_setting.rb +++ b/lib/api/entities/application_setting.rb @@ -27,6 +27,14 @@ module API expose(*::ApplicationSettingsHelper.external_authorization_service_attributes) + # Also expose these columns under their new attribute names. + # + # TODO: Once we rename the columns, we have to swap this around and keep supporting the old names until v5. + # https://gitlab.com/gitlab-org/gitlab/-/issues/340031 + expose :throttle_unauthenticated_enabled, as: :throttle_unauthenticated_web_enabled + expose :throttle_unauthenticated_period_in_seconds, as: :throttle_unauthenticated_web_period_in_seconds + expose :throttle_unauthenticated_requests_per_period, as: :throttle_unauthenticated_web_requests_per_period + # support legacy names, can be removed in v5 expose :password_authentication_enabled_for_web, as: :password_authentication_enabled expose :password_authentication_enabled_for_web, as: :signin_enabled diff --git a/lib/api/helpers/settings_helpers.rb b/lib/api/helpers/settings_helpers.rb index a3ea1057bc8..82de4917f0b 100644 --- a/lib/api/helpers/settings_helpers.rb +++ b/lib/api/helpers/settings_helpers.rb @@ -10,10 +10,18 @@ module API end def self.optional_attributes - [*::ApplicationSettingsHelper.visible_attributes, - *::ApplicationSettingsHelper.external_authorization_service_attributes, - *::ApplicationSettingsHelper.deprecated_attributes, - :performance_bar_allowed_group_id].freeze + [ + *::ApplicationSettingsHelper.visible_attributes, + *::ApplicationSettingsHelper.external_authorization_service_attributes, + *::ApplicationSettingsHelper.deprecated_attributes, + :performance_bar_allowed_group_id, + # TODO: Once we rename these columns, we can remove them here and add the old + # names to `ApplicationSettingsHelper.deprecated_attributes` instead. + # https://gitlab.com/gitlab-org/gitlab/-/issues/340031 + :throttle_unauthenticated_web_enabled, + :throttle_unauthenticated_web_period_in_seconds, + :throttle_unauthenticated_web_requests_per_period + ].freeze end end end diff --git a/lib/api/settings.rb b/lib/api/settings.rb index aac195f0668..52fc8c30108 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -225,6 +225,16 @@ module API attrs[:asset_proxy_allowlist] = attrs.delete(:asset_proxy_whitelist) end + # Also accept these attributes under their new names. + # + # TODO: Once we rename the columns, we have to swap this around and keep supporting the old names until v5. + # https://gitlab.com/gitlab-org/gitlab/-/issues/340031 + %w[enabled period_in_seconds requests_per_period].each do |suffix| + old_name = :"throttle_unauthenticated_#{suffix}" + new_name = :"throttle_unauthenticated_web_#{suffix}" + attrs[old_name] = attrs.delete(new_name) if attrs.has_key?(new_name) + end + # since 13.0 it's not possible to disable hashed storage - support can be removed in 14.0 attrs.delete(:hashed_storage_enabled) if attrs.has_key?(:hashed_storage_enabled) diff --git a/lib/gitlab/database/async_indexes/migration_helpers.rb b/lib/gitlab/database/async_indexes/migration_helpers.rb index 0afb47ef16d..2f990aba2fb 100644 --- a/lib/gitlab/database/async_indexes/migration_helpers.rb +++ b/lib/gitlab/database/async_indexes/migration_helpers.rb @@ -55,11 +55,14 @@ module Gitlab schema_creation = ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation.new(ApplicationRecord.connection) definition = schema_creation.accept(create_index) - async_index = PostgresAsyncIndex.safe_find_or_create_by!(name: index_name) do |rec| + async_index = PostgresAsyncIndex.find_or_create_by!(name: index_name) do |rec| rec.table_name = table_name rec.definition = definition end + async_index.definition = definition + async_index.save! # No-op if definition is not changed + Gitlab::AppLogger.info( message: 'Prepared index for async creation', table_name: async_index.table_name, diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 9de12fcc1eb..cf3cf30b75e 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -897,6 +897,9 @@ msgstr "" msgid "%{state} epics" msgstr "" +msgid "%{strongOpen}Warning:%{strongClose} SAML group links can cause GitLab to automatically remove members from groups." +msgstr "" + msgid "%{strongStart}Tip:%{strongEnd} You can also checkout merge requests locally by %{linkStart}following these guidelines%{linkEnd}" msgstr "" @@ -1200,6 +1203,9 @@ msgstr "" msgid "." msgstr "" +msgid "/" +msgstr "" + msgid "0 bytes" msgstr "" @@ -9525,6 +9531,9 @@ msgstr "" msgid "Create new..." msgstr "" +msgid "Create or import your first project" +msgstr "" + msgid "Create project" msgstr "" @@ -16114,6 +16123,9 @@ msgstr "" msgid "GroupSAML|To be able to prohibit outer forks, you first need to enforce dedicate group managed accounts." msgstr "" +msgid "GroupSAML|Use SAML group links to manage group membership using SAML." +msgstr "" + msgid "GroupSAML|Valid SAML Response" msgstr "" @@ -26615,9 +26627,15 @@ msgstr "" msgid "Projects are graded based on the highest severity vulnerability present" msgstr "" +msgid "Projects are organized into groups" +msgstr "" + msgid "Projects contributed to" msgstr "" +msgid "Projects help you organize your work. They contain your file repository, issues, merge requests, and so much more." +msgstr "" + msgid "Projects shared with %{group_name}" msgstr "" @@ -38183,6 +38201,9 @@ msgstr "" msgid "You can also use project access tokens with Git to authenticate over HTTP(S). %{link_start}Learn more.%{link_end}" msgstr "" +msgid "You can always change your URL later" +msgstr "" + msgid "You can always edit this later" msgstr "" @@ -38882,6 +38903,9 @@ msgstr "" msgid "Your project limit is %{limit} projects! Please contact your administrator to increase it" msgstr "" +msgid "Your project will be created at:" +msgstr "" + msgid "Your projects" msgstr "" @@ -40660,3 +40684,9 @@ msgstr "" msgid "your settings" msgstr "" + +msgid "{group}" +msgstr "" + +msgid "{project}" +msgstr "" diff --git a/package.json b/package.json index 5fb256b96e4..ea3969cf894 100644 --- a/package.json +++ b/package.json @@ -201,7 +201,7 @@ }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.10.1", - "@gitlab/eslint-plugin": "9.2.0", + "@gitlab/eslint-plugin": "9.3.0", "@gitlab/stylelint-config": "2.3.0", "@testing-library/dom": "^7.16.2", "@vue/test-utils": "1.2.0", diff --git a/scripts/rspec_helpers.sh b/scripts/rspec_helpers.sh index 797d9188f81..4fc62038d4f 100644 --- a/scripts/rspec_helpers.sh +++ b/scripts/rspec_helpers.sh @@ -159,7 +159,7 @@ function rspec_paralellized_job() { local rspec_args="-Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}" - if [[ -n $RSPEC_TESTS_MAPPING_ENABLED ]]; then + if [[ -n $MINIMAL_RSPEC_ENABLED ]]; then tooling/bin/parallel_rspec --rspec_args "${rspec_args}" --filter "tmp/matching_tests.txt" else tooling/bin/parallel_rspec --rspec_args "${rspec_args}" diff --git a/spec/controllers/projects/analytics/cycle_analytics/summary_controller_spec.rb b/spec/controllers/projects/analytics/cycle_analytics/summary_controller_spec.rb index 1832b84ab6e..a366b2583d4 100644 --- a/spec/controllers/projects/analytics/cycle_analytics/summary_controller_spec.rb +++ b/spec/controllers/projects/analytics/cycle_analytics/summary_controller_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Projects::Analytics::CycleAnalytics::SummaryController do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } - let(:params) { { namespace_id: project.namespace.to_param, project_id: project.to_param, created_after: '2010-01-01', created_before: '2010-01-02' } } + let(:params) { { namespace_id: project.namespace.to_param, project_id: project.to_param, created_after: '2010-01-01', created_before: '2010-02-01' } } before do sign_in(user) @@ -42,5 +42,39 @@ RSpec.describe Projects::Analytics::CycleAnalytics::SummaryController do expect(response).to have_gitlab_http_status(:not_found) end end + + context 'when filters are applied' do + let_it_be(:author) { create(:user) } + let_it_be(:milestone) { create(:milestone, title: 'milestone 1', project: project) } + let_it_be(:issue_with_author) { create(:issue, project: project, author: author, created_at: Date.new(2010, 1, 15)) } + let_it_be(:issue_with_other_author) { create(:issue, project: project, author: user, created_at: Date.new(2010, 1, 15)) } + let_it_be(:issue_with_milestone) { create(:issue, project: project, milestone: milestone, created_at: Date.new(2010, 1, 15)) } + + before do + project.add_reporter(user) + end + + it 'filters by author username' do + params[:author_username] = author.username + + subject + + expect(response).to be_successful + + issue_count = json_response.first + expect(issue_count['value']).to eq('1') + end + + it 'filters by milestone title' do + params[:milestone_title] = milestone.title + + subject + + expect(response).to be_successful + + issue_count = json_response.first + expect(issue_count['value']).to eq('1') + end + end end end diff --git a/spec/features/merge_requests/user_sees_empty_state_spec.rb b/spec/features/merge_requests/user_sees_empty_state_spec.rb index ac07b31731d..056da53c47b 100644 --- a/spec/features/merge_requests/user_sees_empty_state_spec.rb +++ b/spec/features/merge_requests/user_sees_empty_state_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Merge request > User sees empty state' do + include ProjectForksHelper + let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } @@ -37,4 +39,23 @@ RSpec.describe 'Merge request > User sees empty state' do expect(page).to have_content('To widen your search, change or remove filters above') end end + + context 'as member of a fork' do + let(:fork_user) { create(:user) } + let(:forked_project) { fork_project(project, fork_user, namespace: fork_user.namespace, repository: true) } + + before do + forked_project.add_maintainer(fork_user) + sign_in(fork_user) + end + + it 'shows an empty state and a "New merge request" button' do + visit project_merge_requests_path(project, search: 'foo') + + expect(page).to have_selector('.empty-state') + within('.empty-state') do + expect(page).to have_link 'New merge request', href: project_new_merge_request_path(forked_project) + end + end + end end diff --git a/spec/frontend/design_management/pages/index_spec.js b/spec/frontend/design_management/pages/index_spec.js index d35c5398b20..ce79feae2e7 100644 --- a/spec/frontend/design_management/pages/index_spec.js +++ b/spec/frontend/design_management/pages/index_spec.js @@ -630,6 +630,16 @@ describe('Design management index page', () => { expect(mockMutate).not.toHaveBeenCalled(); }); + it('does not upload designs if designs wrapper is destroyed', () => { + findDesignsWrapper().trigger('mouseenter'); + + wrapper.destroy(); + + document.dispatchEvent(event); + + expect(mockMutate).not.toHaveBeenCalled(); + }); + describe('when designs wrapper is hovered', () => { let realDateNow; const today = () => new Date('2020-12-25'); diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap similarity index 97% rename from spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap rename to spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap index 59b42de2485..3aa0e99a858 100644 --- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap +++ b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Learn GitLab Design A renders correctly 1`] = ` +exports[`Learn GitLab renders correctly 1`] = `
{ +describe('Learn GitLab', () => { let wrapper; const createWrapper = () => { - wrapper = mount(LearnGitlabA, { propsData: { actions: testActions, sections: testSections } }); + wrapper = mount(LearnGitlab, { propsData: { actions: testActions, sections: testSections } }); }; beforeEach(() => { diff --git a/spec/lib/gitlab/database/async_indexes/migration_helpers_spec.rb b/spec/lib/gitlab/database/async_indexes/migration_helpers_spec.rb index ed15951dfb0..eb16a8ccfa5 100644 --- a/spec/lib/gitlab/database/async_indexes/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/async_indexes/migration_helpers_spec.rb @@ -150,6 +150,23 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do migration.prepare_async_index(table_name, 'id') end.not_to change { index_model.where(name: index_name).count } end + + it 'updates definition if changed' do + index = create(:postgres_async_index, table_name: table_name, name: index_name, definition: '...') + + expect do + migration.prepare_async_index(table_name, 'id', name: index_name) + end.to change { index.reload.definition } + end + + it 'does not update definition if not changed' do + definition = "CREATE INDEX CONCURRENTLY \"index_#{table_name}_on_id\" ON \"#{table_name}\" (\"id\")" + index = create(:postgres_async_index, table_name: table_name, name: index_name, definition: definition) + + expect do + migration.prepare_async_index(table_name, 'id', name: index_name) + end.not_to change { index.reload.updated_at } + end end context 'when the async index table does not exist' do diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index ccc9f8c50c4..47bc3eb74a6 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -345,38 +345,12 @@ RSpec.describe API::CommitStatuses do expect(json_response['status']).to eq('success') end - context 'feature flags' do - using RSpec::Parameterized::TableSyntax + it 'retries the commit status', :sidekiq_might_not_need_inline do + post_request - where(:ci_fix_commit_status_retried, :ci_remove_update_retried_from_process_pipeline, :previous_statuses_retried) do - true | true | true - true | false | true - false | true | false - false | false | true - end - - with_them do - before do - stub_feature_flags( - ci_fix_commit_status_retried: ci_fix_commit_status_retried, - ci_remove_update_retried_from_process_pipeline: ci_remove_update_retried_from_process_pipeline - ) - end - - it 'retries a commit status', :sidekiq_might_not_need_inline do - post_request - - expect(CommitStatus.count).to eq 2 - - if previous_statuses_retried - expect(CommitStatus.first).to be_retried - expect(CommitStatus.last.pipeline).to be_success - else - expect(CommitStatus.first).not_to be_retried - expect(CommitStatus.last.pipeline).to be_failed - end - end - end + expect(CommitStatus.count).to eq 2 + expect(CommitStatus.first).to be_retried + expect(CommitStatus.last.pipeline).to be_success end end diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index 4008b57a1cf..fe1d5146568 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -222,6 +222,45 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do expect(json_response['asset_proxy_allowlist']).to eq(['example.com', '*.example.com', 'localhost']) end + it 'supports the deprecated `throttle_unauthenticated_*` attributes' do + put api('/application/settings', admin), params: { + throttle_unauthenticated_enabled: true, + throttle_unauthenticated_period_in_seconds: 123, + throttle_unauthenticated_requests_per_period: 456 + } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to include( + 'throttle_unauthenticated_enabled' => true, + 'throttle_unauthenticated_period_in_seconds' => 123, + 'throttle_unauthenticated_requests_per_period' => 456, + 'throttle_unauthenticated_web_enabled' => true, + 'throttle_unauthenticated_web_period_in_seconds' => 123, + 'throttle_unauthenticated_web_requests_per_period' => 456 + ) + end + + it 'prefers the new `throttle_unauthenticated_web_*` attributes' do + put api('/application/settings', admin), params: { + throttle_unauthenticated_enabled: false, + throttle_unauthenticated_period_in_seconds: 0, + throttle_unauthenticated_requests_per_period: 0, + throttle_unauthenticated_web_enabled: true, + throttle_unauthenticated_web_period_in_seconds: 123, + throttle_unauthenticated_web_requests_per_period: 456 + } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to include( + 'throttle_unauthenticated_enabled' => true, + 'throttle_unauthenticated_period_in_seconds' => 123, + 'throttle_unauthenticated_requests_per_period' => 456, + 'throttle_unauthenticated_web_enabled' => true, + 'throttle_unauthenticated_web_period_in_seconds' => 123, + 'throttle_unauthenticated_web_requests_per_period' => 456 + ) + end + it 'disables ability to switch to legacy storage' do put api("/application/settings", admin), params: { hashed_storage_enabled: false } diff --git a/spec/services/application_settings/update_service_spec.rb b/spec/services/application_settings/update_service_spec.rb index dabff37bea7..a0c30620302 100644 --- a/spec/services/application_settings/update_service_spec.rb +++ b/spec/services/application_settings/update_service_spec.rb @@ -336,6 +336,28 @@ RSpec.describe ApplicationSettings::UpdateService do end end + context 'when general rate limits are passed' do + let(:params) do + { + throttle_authenticated_api_enabled: true, + throttle_authenticated_api_period_in_seconds: 10, + throttle_authenticated_api_requests_per_period: 20, + throttle_authenticated_web_enabled: true, + throttle_authenticated_web_period_in_seconds: 30, + throttle_authenticated_web_requests_per_period: 40, + throttle_unauthenticated_enabled: true, + throttle_unauthenticated_period_in_seconds: 50, + throttle_unauthenticated_requests_per_period: 60 + } + end + + it 'updates general throttle settings' do + subject.execute + + expect(application_settings.reload).to have_attributes(params) + end + end + context 'when package registry rate limits are passed' do let(:params) do { diff --git a/spec/services/ci/pipelines/add_job_service_spec.rb b/spec/services/ci/pipelines/add_job_service_spec.rb index bdf7e577fa8..3a77d26dd9e 100644 --- a/spec/services/ci/pipelines/add_job_service_spec.rb +++ b/spec/services/ci/pipelines/add_job_service_spec.rb @@ -59,18 +59,6 @@ RSpec.describe Ci::Pipelines::AddJobService do end end - context 'when the FF ci_fix_commit_status_retried is disabled' do - before do - stub_feature_flags(ci_fix_commit_status_retried: false) - end - - it 'does not call update_older_statuses_retried!' do - expect(job).not_to receive(:update_older_statuses_retried!) - - execute - end - end - context 'exclusive lock' do let(:lock_uuid) { 'test' } let(:lock_key) { "ci:pipelines:#{pipeline.id}:add-job" } diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 9455995c47c..e15d9341fd1 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -346,6 +346,12 @@ RSpec.describe Projects::CreateService, '#execute' do expect(imported_project.import_data.data).to eq(import_data[:data]) expect(imported_project.import_url).to eq('http://import-url') end + + it 'tracks for the combined_registration experiment', :experiment do + expect(experiment(:combined_registration)).to track(:import_project).on_next_instance + + imported_project + end end context 'builds_enabled global setting' do diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 1edcbd01861..2a0c794cebb 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -295,18 +295,6 @@ RSpec.describe Projects::UpdatePagesService do expect(older_deploy_job.reload).to be_retried end - - context 'when FF ci_fix_commit_status_retried is disabled' do - before do - stub_feature_flags(ci_fix_commit_status_retried: false) - end - - it 'does not mark older pages:deploy jobs retried' do - expect(execute).to eq(:success) - - expect(older_deploy_job.reload).not_to be_retried - end - end end private diff --git a/spec/support/database/cross-join-allowlist.yml b/spec/support/database/cross-join-allowlist.yml index 2db845801d2..8047fe434ed 100644 --- a/spec/support/database/cross-join-allowlist.yml +++ b/spec/support/database/cross-join-allowlist.yml @@ -75,7 +75,6 @@ - "./ee/spec/requests/api/vulnerability_findings_spec.rb" - "./ee/spec/serializers/dashboard_environment_entity_spec.rb" - "./ee/spec/serializers/dashboard_environments_serializer_spec.rb" -- "./ee/spec/serializers/ee/build_details_entity_spec.rb" - "./ee/spec/serializers/merge_request_poll_widget_entity_spec.rb" - "./ee/spec/services/auto_merge/add_to_merge_train_when_pipeline_succeeds_service_spec.rb" - "./ee/spec/services/ci/create_pipeline_service/needs_spec.rb" @@ -308,7 +307,6 @@ - "./spec/requests/api/merge_requests_spec.rb" - "./spec/requests/api/package_files_spec.rb" - "./spec/requests/projects/cycle_analytics_events_spec.rb" -- "./spec/serializers/build_details_entity_spec.rb" - "./spec/serializers/ci/pipeline_entity_spec.rb" - "./spec/serializers/merge_request_serializer_spec.rb" - "./spec/serializers/pipeline_details_entity_spec.rb" @@ -331,7 +329,6 @@ - "./spec/services/ci/play_build_service_spec.rb" - "./spec/services/ci/register_job_service_spec.rb" - "./spec/services/ci/retry_pipeline_service_spec.rb" -- "./spec/services/ci/update_build_queue_service_spec.rb" - "./spec/services/clusters/applications/prometheus_config_service_spec.rb" - "./spec/services/deployments/older_deployments_drop_service_spec.rb" - "./spec/services/environments/auto_stop_service_spec.rb" diff --git a/spec/support/helpers/live_debugger.rb b/spec/support/helpers/live_debugger.rb index f4199d518a3..d196a6dc746 100644 --- a/spec/support/helpers/live_debugger.rb +++ b/spec/support/helpers/live_debugger.rb @@ -16,7 +16,7 @@ module LiveDebugger puts "The current user credentials are: #{@current_user.username} / #{@current_user.password}" if @current_user puts "Press any key to resume the execution of the example!!" - `open #{current_url}` if is_headless_disabled? + `open #{current_url}` unless is_headless_disabled? loop until $stdin.getch diff --git a/spec/workers/deployments/hooks_worker_spec.rb b/spec/workers/deployments/hooks_worker_spec.rb index 5d8edf85dd9..b4a91cff2ac 100644 --- a/spec/workers/deployments/hooks_worker_spec.rb +++ b/spec/workers/deployments/hooks_worker_spec.rb @@ -52,7 +52,6 @@ RSpec.describe Deployments::HooksWorker do it_behaves_like 'worker with data consistency', described_class, - feature_flag: :load_balancing_for_deployments_hooks_worker, data_consistency: :delayed end end diff --git a/tooling/bin/find_tests b/tooling/bin/find_tests index 97fadf406fe..a82b6bb5d46 100755 --- a/tooling/bin/find_tests +++ b/tooling/bin/find_tests @@ -22,10 +22,7 @@ changed_files = mr_changes.changes.map { |change| change['new_path'] } tff = TestFileFinder::FileFinder.new(paths: changed_files).tap do |file_finder| file_finder.use TestFileFinder::MappingStrategies::PatternMatching.load('tests.yml') - - if ENV['RSPEC_TESTS_MAPPING_ENABLED'] - file_finder.use TestFileFinder::MappingStrategies::DirectMatching.load_json(ENV['RSPEC_TESTS_MAPPING_PATH']) - end + file_finder.use TestFileFinder::MappingStrategies::DirectMatching.load_json(ENV['RSPEC_TESTS_MAPPING_PATH']) end File.write(output_file, tff.test_files.uniq.join(' ')) diff --git a/yarn.lock b/yarn.lock index e03f167e73a..2e9c8654e2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -933,10 +933,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/at.js/-/at.js-1.5.7.tgz#1ee6f838cc4410a1d797770934df91d90df8179e" integrity sha512-c6ySRK/Ma7lxwpIVbSAF3P+xiTLrNTGTLRx4/pHK111AdFxwgUwrYF6aVZFXvmG65jHOJHoa0eQQ21RW6rm0Rg== -"@gitlab/eslint-plugin@9.2.0": - version "9.2.0" - resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin/-/eslint-plugin-9.2.0.tgz#a281883ebe3cd06a88503c590525a191eb78a885" - integrity sha512-iVANLTwn5S4efVUWKX5crLTUChrh3HvAnUrVvLEXTgBw/Aup4t4L5tYLs5YOh5ofw08SUEaaxvAq5ooSqSPqCA== +"@gitlab/eslint-plugin@9.3.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin/-/eslint-plugin-9.3.0.tgz#c1765b28d5a2a29143c0a556650fb7527cd9ab0d" + integrity sha512-c0bR9sgZuyHsC8xzYNrTl6koXBrLgBnVGG2UWwRbs8QnAF0Sf3LTPMjq0vulXZgKqPvMG++em0O5d6nN+oWvuQ== dependencies: babel-eslint "^10.0.3" eslint-config-airbnb-base "^14.2.1"