diff options
84 files changed, 322 insertions, 269 deletions
diff --git a/app/assets/javascripts/boards/components/board_card_inner.vue b/app/assets/javascripts/boards/components/board_card_inner.vue index 6c00f987b16..db80d48239b 100644 --- a/app/assets/javascripts/boards/components/board_card_inner.vue +++ b/app/assets/javascripts/boards/components/board_card_inner.vue @@ -214,6 +214,14 @@ export default { class="confidential-icon gl-mr-2" :aria-label="__('Confidential')" /> + <gl-icon + v-if="item.hidden" + v-gl-tooltip + name="spam" + :title="__('This issue is hidden because its author has been banned')" + class="gl-mr-2 hidden-icon" + data-testid="hidden-icon" + /> <a :href="item.path || item.webUrl || ''" :title="item.title" diff --git a/app/assets/javascripts/boards/graphql/issue.fragment.graphql b/app/assets/javascripts/boards/graphql/issue.fragment.graphql index 0ff70703e1a..1b14396fb5c 100644 --- a/app/assets/javascripts/boards/graphql/issue.fragment.graphql +++ b/app/assets/javascripts/boards/graphql/issue.fragment.graphql @@ -12,6 +12,7 @@ fragment IssueNode on Issue { humanTotalTimeSpent emailsDisabled confidential + hidden webUrl relativePosition assignees { diff --git a/app/assets/javascripts/pages/projects/packages/packages/show/index.js b/app/assets/javascripts/pages/projects/packages/packages/show/index.js index ee06f247ddc..2dee87985cb 100644 --- a/app/assets/javascripts/pages/projects/packages/packages/show/index.js +++ b/app/assets/javascripts/pages/projects/packages/packages/show/index.js @@ -1,11 +1,3 @@ -(async function initPackage() { - let app; - if (document.getElementById('js-vue-packages-detail-new')) { - app = await import( - /* webpackChunkName: 'new_package_app' */ `~/packages_and_registries/package_registry/pages/details.js` - ); - } else { - app = await import('~/packages/details/'); - } - app.default(); -})(); +import initPackageDetails from '~/packages_and_registries/package_registry/pages/details'; + +initPackageDetails(); diff --git a/app/assets/javascripts/projects/storage_counter/queries/project_storage.query.graphql b/app/assets/javascripts/projects/storage_counter/queries/project_storage.query.graphql index 8e549846875..a4f2c529522 100644 --- a/app/assets/javascripts/projects/storage_counter/queries/project_storage.query.graphql +++ b/app/assets/javascripts/projects/storage_counter/queries/project_storage.query.graphql @@ -3,6 +3,7 @@ query getProjectStorageCount($fullPath: ID!) { id statistics { buildArtifactsSize + pipelineArtifactsSize lfsObjectsSize packagesSize repositorySize diff --git a/app/assets/stylesheets/page_bundles/boards.scss b/app/assets/stylesheets/page_bundles/boards.scss index eb2d2252526..00c28d2f3f1 100644 --- a/app/assets/stylesheets/page_bundles/boards.scss +++ b/app/assets/stylesheets/page_bundles/boards.scss @@ -248,7 +248,8 @@ margin-right: 4px; } - .confidential-icon { + .confidential-icon, + .hidden-icon { color: var(--orange-500, $orange-500); cursor: help; } diff --git a/app/controllers/projects/learn_gitlab_controller.rb b/app/controllers/projects/learn_gitlab_controller.rb index d1a8d8b4466..91a43c5f03f 100644 --- a/app/controllers/projects/learn_gitlab_controller.rb +++ b/app/controllers/projects/learn_gitlab_controller.rb @@ -12,6 +12,6 @@ class Projects::LearnGitlabController < Projects::ApplicationController private def check_experiment_enabled? - return access_denied! unless helpers.learn_gitlab_experiment_enabled?(project) + return access_denied! unless helpers.learn_gitlab_enabled?(project) end end diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 6abb1112cb2..dfbaf7928de 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -323,6 +323,9 @@ module ApplicationSettingsHelper :throttle_authenticated_files_api_enabled, :throttle_authenticated_files_api_period_in_seconds, :throttle_authenticated_files_api_requests_per_period, + :throttle_unauthenticated_api_enabled, + :throttle_unauthenticated_api_period_in_seconds, + :throttle_unauthenticated_api_requests_per_period, :throttle_unauthenticated_enabled, :throttle_unauthenticated_period_in_seconds, :throttle_unauthenticated_requests_per_period, diff --git a/app/helpers/learn_gitlab_helper.rb b/app/helpers/learn_gitlab_helper.rb index 926766d8d53..4fb7a05a0e9 100644 --- a/app/helpers/learn_gitlab_helper.rb +++ b/app/helpers/learn_gitlab_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LearnGitlabHelper - def learn_gitlab_experiment_enabled?(project) + def learn_gitlab_enabled?(project) return false unless current_user learn_gitlab_onboarding_available?(project) diff --git a/app/helpers/packages_helper.rb b/app/helpers/packages_helper.rb index 1a466c9d170..ebf30fb3538 100644 --- a/app/helpers/packages_helper.rb +++ b/app/helpers/packages_helper.rb @@ -64,9 +64,8 @@ module PackagesHelper project.container_repositories.exists? end - def package_details_data(project, package, use_presenter = false) + def package_details_data(project, package) { - package: use_presenter ? package_from_presenter(package) : nil, package_id: package.id, can_delete: can?(current_user, :destroy_package, project).to_s, svg_path: image_path('illustrations/no-packages.svg'), diff --git a/app/helpers/sidebars_helper.rb b/app/helpers/sidebars_helper.rb index 9837006c6d9..9002fdda128 100644 --- a/app/helpers/sidebars_helper.rb +++ b/app/helpers/sidebars_helper.rb @@ -87,7 +87,7 @@ module SidebarsHelper { current_user: user, container: project, - learn_gitlab_experiment_enabled: learn_gitlab_experiment_enabled?(project), + learn_gitlab_enabled: learn_gitlab_enabled?(project), current_ref: current_ref, jira_issues_integration: project_jira_issues_integration?, can_view_pipeline_editor: can_view_pipeline_editor?(project), diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index d8b42348ba9..6640fa355d8 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -468,6 +468,14 @@ class ApplicationSetting < ApplicationRecord length: { maximum: 255, message: _('is too long (maximum is %{count} characters)') }, allow_blank: true + validates :throttle_unauthenticated_api_requests_per_period, + presence: true, + numericality: { only_integer: true, greater_than: 0 } + + validates :throttle_unauthenticated_api_period_in_seconds, + presence: true, + numericality: { only_integer: true, greater_than: 0 } + validates :throttle_unauthenticated_requests_per_period, presence: true, numericality: { only_integer: true, greater_than: 0 } diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index a211e7cd4b7..612fda158d3 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -181,6 +181,9 @@ module ApplicationSettingImplementation throttle_protected_paths_enabled: false, throttle_protected_paths_in_seconds: 10, throttle_protected_paths_per_period: 60, + throttle_unauthenticated_api_enabled: false, + throttle_unauthenticated_api_period_in_seconds: 3600, + throttle_unauthenticated_api_requests_per_period: 3600, throttle_unauthenticated_enabled: false, throttle_unauthenticated_period_in_seconds: 3600, throttle_unauthenticated_requests_per_period: 3600, diff --git a/app/models/project.rb b/app/models/project.rb index fc2bf70f8df..2d585ca5a0e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -120,7 +120,6 @@ class Project < ApplicationRecord use_fast_destroy :build_trace_chunks - after_destroy -> { run_after_commit { legacy_remove_pages } } after_destroy :remove_exports after_validation :check_pending_delete @@ -1903,27 +1902,6 @@ class Project < ApplicationRecord .delete_all end - # TODO: remove this method https://gitlab.com/gitlab-org/gitlab/-/issues/320775 - # rubocop: disable CodeReuse/ServiceClass - def legacy_remove_pages - return unless ::Settings.pages.local_store.enabled - - # Projects with a missing namespace cannot have their pages removed - return unless namespace - - mark_pages_as_not_deployed unless destroyed? - - # 1. We rename pages to temporary directory - # 2. We wait 5 minutes, due to NFS caching - # 3. We asynchronously remove pages with force - temp_path = "#{path}.#{SecureRandom.hex}.deleted" - - if Gitlab::PagesTransfer.new.rename_project(path, temp_path, namespace.full_path) - PagesWorker.perform_in(5.minutes, :remove, namespace.full_path, temp_path) - end - end - # rubocop: enable CodeReuse/ServiceClass - def mark_pages_as_deployed(artifacts_archive: nil) ensure_pages_metadatum.update!(deployed: true, artifacts_archive: artifacts_archive) end diff --git a/app/services/pages/delete_service.rb b/app/services/pages/delete_service.rb index f7d3d70aad6..8d33e6c1000 100644 --- a/app/services/pages/delete_service.rb +++ b/app/services/pages/delete_service.rb @@ -12,9 +12,6 @@ module Pages PagesDomain.for_project(project).delete_all DestroyPagesDeploymentsWorker.perform_async(project.id) - - # TODO: remove this call https://gitlab.com/gitlab-org/gitlab/-/issues/320775 - PagesRemoveWorker.perform_async(project.id) if ::Settings.pages.local_store.enabled end end end diff --git a/app/views/projects/packages/packages/show.html.haml b/app/views/projects/packages/packages/show.html.haml index 42c31b3272f..ebdc9e654f6 100644 --- a/app/views/projects/packages/packages/show.html.haml +++ b/app/views/projects/packages/packages/show.html.haml @@ -6,7 +6,4 @@ .row .col-12 - - if Feature.enabled?(:package_details_apollo, default_enabled: :yaml) - #js-vue-packages-detail-new{ data: package_details_data(@project, @package) } - - else - #js-vue-packages-detail{ data: package_details_data(@project, @package, true) } + #js-vue-packages-detail-new{ data: package_details_data(@project, @package) } diff --git a/app/workers/pages_remove_worker.rb b/app/workers/pages_remove_worker.rb index 6d1200b8f51..4de99b8654d 100644 --- a/app/workers/pages_remove_worker.rb +++ b/app/workers/pages_remove_worker.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# TODO: remove this worker https://gitlab.com/gitlab-org/gitlab/-/issues/320775 +# TODO: remove this worker https://gitlab.com/gitlab-org/gitlab/-/issues/340641 class PagesRemoveWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker @@ -11,9 +11,6 @@ class PagesRemoveWorker # rubocop:disable Scalability/IdempotentWorker loggable_arguments 0 def perform(project_id) - project = Project.find_by_id(project_id) - return unless project - - project.legacy_remove_pages + # no-op end end diff --git a/config/feature_flags/development/package_details_apollo.yml b/config/feature_flags/development/package_details_apollo.yml deleted file mode 100644 index fbab4c2c7c8..00000000000 --- a/config/feature_flags/development/package_details_apollo.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: package_details_apollo -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64939 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334786 -milestone: '14.1' -type: development -group: group::package -default_enabled: true diff --git a/config/metrics/counts_28d/20210216180955_projects_with_prometheus_alerts.yml b/config/metrics/counts_28d/20210216180955_projects_with_prometheus_alerts.yml index 301c0db93b6..a67113825e8 100644 --- a/config/metrics/counts_28d/20210216180955_projects_with_prometheus_alerts.yml +++ b/config/metrics/counts_28d/20210216180955_projects_with_prometheus_alerts.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.configure.projects_with_prometheus_alerts description: Projects with Prometheus alerting enabled product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216180956_clusters.yml b/config/metrics/counts_28d/20210216180956_clusters.yml index e740a7ef2e7..ca503bcd815 100644 --- a/config/metrics/counts_28d/20210216180956_clusters.yml +++ b/config/metrics/counts_28d/20210216180956_clusters.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.clusters description: Count users creating clusters in last 28 days. product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216180958_clusters_applications_prometheus.yml b/config/metrics/counts_28d/20210216180958_clusters_applications_prometheus.yml index 2ad307ce7a5..e9f5a6ad68a 100644 --- a/config/metrics/counts_28d/20210216180958_clusters_applications_prometheus.yml +++ b/config/metrics/counts_28d/20210216180958_clusters_applications_prometheus.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.clusters_applications_prometheus description: Users creating clusters with Prometheus enabled in last 28 days. product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216181000_operations_dashboard_default_dashboard.yml b/config/metrics/counts_28d/20210216181000_operations_dashboard_default_dashboard.yml index 14ab239037c..7e22b0837dc 100644 --- a/config/metrics/counts_28d/20210216181000_operations_dashboard_default_dashboard.yml +++ b/config/metrics/counts_28d/20210216181000_operations_dashboard_default_dashboard.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.operations_dashboard_default_dashboard description: Active users with enabled operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216181002_projects_with_tracing_enabled.yml b/config/metrics/counts_28d/20210216181002_projects_with_tracing_enabled.yml index e0e5e90dc51..dbf538c27e5 100644 --- a/config/metrics/counts_28d/20210216181002_projects_with_tracing_enabled.yml +++ b/config/metrics/counts_28d/20210216181002_projects_with_tracing_enabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.projects_with_tracing_enabled description: Projects with tracing enabled product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: tracing value_type: number diff --git a/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml b/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml index f7fe9f25b0d..d1538f92c25 100644 --- a/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml +++ b/config/metrics/counts_28d/20210216181004_projects_with_error_tracking_enabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.projects_with_error_tracking_enabled description: Count of users creating projects with error tracking enabled. product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216181006_operations_dashboard_users_with_projects_added.yml b/config/metrics/counts_28d/20210216181006_operations_dashboard_users_with_projects_added.yml index 39fd144b66d..9f03731c556 100644 --- a/config/metrics/counts_28d/20210216181006_operations_dashboard_users_with_projects_added.yml +++ b/config/metrics/counts_28d/20210216181006_operations_dashboard_users_with_projects_added.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage_monthly.monitor.operations_dashboard_users_with_projects_added description: Active users with projects on operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216183159_projects_with_alerts_created.yml b/config/metrics/counts_28d/20210216183159_projects_with_alerts_created.yml index 4f872e77b61..ae342aa8735 100644 --- a/config/metrics/counts_28d/20210216183159_projects_with_alerts_created.yml +++ b/config/metrics/counts_28d/20210216183159_projects_with_alerts_created.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts_monthly.projects_with_alerts_created description: Monthly count of unique projects with HTTP alerting enabled product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_28d/20210216184140_testing_total_unique_counts_monthly.yml b/config/metrics/counts_28d/20210216184140_testing_total_unique_counts_monthly.yml index e8968722dd8..14042fc25f7 100644 --- a/config/metrics/counts_28d/20210216184140_testing_total_unique_counts_monthly.yml +++ b/config/metrics/counts_28d/20210216184140_testing_total_unique_counts_monthly.yml @@ -1,11 +1,11 @@ --- data_category: optional key_path: redis_hll_counters.testing.testing_total_unique_counts_monthly -description: '' -product_section: '' -product_stage: '' -product_group: '' -product_category: '' +description: Total users for events under testing category +product_section: devops +product_section: growth +product_stage: growth +product_group: group::product intelligence value_type: number status: removed time_frame: 28d diff --git a/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml b/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml index b1cafeff172..a0f51ae8fd2 100644 --- a/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml +++ b/config/metrics/counts_all/20210216175236_project_clusters_enabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.project_clusters_enabled description: Total GitLab Managed clusters attached to projects product_section: ops -product_stage: +product_stage: configure product_group: group::configure product_category: kubernetes_management value_type: number @@ -17,6 +17,5 @@ tier: - free - premium - ultimate -skip_validation: true performance_indicator_type: [] milestone: "<13.9" diff --git a/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml b/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml index b7618704997..40ac2625702 100644 --- a/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml +++ b/config/metrics/counts_all/20210216175248_instance_clusters_disabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.instance_clusters_disabled description: Total GitLab Managed disabled clusters previously attached to the instance product_section: ops -product_stage: +product_stage: configure product_group: group::configure product_category: kubernetes_management value_type: number @@ -17,6 +17,5 @@ tier: - free - premium - ultimate -skip_validation: true performance_indicator_type: [] milestone: "<13.9" diff --git a/config/metrics/counts_all/20210216175324_terraform_reports.yml b/config/metrics/counts_all/20210216175324_terraform_reports.yml index ab6ad011bbe..029478506ea 100644 --- a/config/metrics/counts_all/20210216175324_terraform_reports.yml +++ b/config/metrics/counts_all/20210216175324_terraform_reports.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.terraform_reports description: Count of Terraform MR reports generated product_section: ops -product_stage: +product_stage: configure product_group: group::configure product_category: infrastructure_as_code value_type: number diff --git a/config/metrics/counts_all/20210216180927_grafana_integrated_projects.yml b/config/metrics/counts_all/20210216180927_grafana_integrated_projects.yml index 2aea7f78569..0d0ed664373 100644 --- a/config/metrics/counts_all/20210216180927_grafana_integrated_projects.yml +++ b/config/metrics/counts_all/20210216180927_grafana_integrated_projects.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.grafana_integrated_projects description: Total Grafana integrations attached to projects product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number @@ -12,7 +12,10 @@ time_frame: all data_source: database distribution: - ce +- ee tier: - free +- premium +- ultimate performance_indicator_type: [] milestone: "<13.9" diff --git a/config/metrics/counts_all/20210216180929_projects_with_tracing_enabled.yml b/config/metrics/counts_all/20210216180929_projects_with_tracing_enabled.yml index 9289a2e773e..1f3aa8837c7 100644 --- a/config/metrics/counts_all/20210216180929_projects_with_tracing_enabled.yml +++ b/config/metrics/counts_all/20210216180929_projects_with_tracing_enabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.projects_with_tracing_enabled description: Projects with tracing enabled product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: tracing value_type: number diff --git a/config/metrics/counts_all/20210216180931_projects_prometheus_active.yml b/config/metrics/counts_all/20210216180931_projects_prometheus_active.yml index 7b800fd9240..fa3bf37df57 100644 --- a/config/metrics/counts_all/20210216180931_projects_prometheus_active.yml +++ b/config/metrics/counts_all/20210216180931_projects_prometheus_active.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.projects_prometheus_active description: Count of projects with active integrations for Prometheus product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180933_groups_prometheus_active.yml b/config/metrics/counts_all/20210216180933_groups_prometheus_active.yml index 5f084a84f57..44c9b24af3a 100644 --- a/config/metrics/counts_all/20210216180933_groups_prometheus_active.yml +++ b/config/metrics/counts_all/20210216180933_groups_prometheus_active.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.groups_prometheus_active description: Count of groups with active integrations for Prometheus product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180934_templates_prometheus_active.yml b/config/metrics/counts_all/20210216180934_templates_prometheus_active.yml index ccd73b22e2a..f9f5507799a 100644 --- a/config/metrics/counts_all/20210216180934_templates_prometheus_active.yml +++ b/config/metrics/counts_all/20210216180934_templates_prometheus_active.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.templates_prometheus_active description: Count of active service templates for Prometheus product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180936_instances_prometheus_active.yml b/config/metrics/counts_all/20210216180936_instances_prometheus_active.yml index c7b15121df3..74b93dc8f5e 100644 --- a/config/metrics/counts_all/20210216180936_instances_prometheus_active.yml +++ b/config/metrics/counts_all/20210216180936_instances_prometheus_active.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.instances_prometheus_active description: Count of active instance-level integrations for Prometheus product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180938_projects_inheriting_prometheus_active.yml b/config/metrics/counts_all/20210216180938_projects_inheriting_prometheus_active.yml index 2f5bdf392a5..580862e5d46 100644 --- a/config/metrics/counts_all/20210216180938_projects_inheriting_prometheus_active.yml +++ b/config/metrics/counts_all/20210216180938_projects_inheriting_prometheus_active.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.projects_inheriting_prometheus_active description: Count of active projects inheriting integrations for Prometheus product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180942_operations_dashboard_default_dashboard.yml b/config/metrics/counts_all/20210216180942_operations_dashboard_default_dashboard.yml index 2403e855547..1ff61371bc6 100644 --- a/config/metrics/counts_all/20210216180942_operations_dashboard_default_dashboard.yml +++ b/config/metrics/counts_all/20210216180942_operations_dashboard_default_dashboard.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.operations_dashboard_default_dashboard description: Active users with enabled operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180944_operations_dashboard_users_with_projects_added.yml b/config/metrics/counts_all/20210216180944_operations_dashboard_users_with_projects_added.yml index 244441dfec9..9f42c53880e 100644 --- a/config/metrics/counts_all/20210216180944_operations_dashboard_users_with_projects_added.yml +++ b/config/metrics/counts_all/20210216180944_operations_dashboard_users_with_projects_added.yml @@ -3,7 +3,7 @@ data_category: optional key_path: counts.operations_dashboard_users_with_projects_added description: Active users with projects on operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180945_clusters.yml b/config/metrics/counts_all/20210216180945_clusters.yml index ad31e5baaba..09658ec3f5c 100644 --- a/config/metrics/counts_all/20210216180945_clusters.yml +++ b/config/metrics/counts_all/20210216180945_clusters.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage.monitor.clusters description: Users creating clusters. product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180947_clusters_applications_prometheus.yml b/config/metrics/counts_all/20210216180947_clusters_applications_prometheus.yml index 4eaf4177888..146e390bea5 100644 --- a/config/metrics/counts_all/20210216180947_clusters_applications_prometheus.yml +++ b/config/metrics/counts_all/20210216180947_clusters_applications_prometheus.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage.monitor.clusters_applications_prometheus description: Users creating clusters with Prometheus enabled. product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180949_operations_dashboard_default_dashboard.yml b/config/metrics/counts_all/20210216180949_operations_dashboard_default_dashboard.yml index bd7e1aee0f5..31c1f060fd2 100644 --- a/config/metrics/counts_all/20210216180949_operations_dashboard_default_dashboard.yml +++ b/config/metrics/counts_all/20210216180949_operations_dashboard_default_dashboard.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage.monitor.operations_dashboard_default_dashboard description: Active users with enabled operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/counts_all/20210216180951_projects_with_tracing_enabled.yml b/config/metrics/counts_all/20210216180951_projects_with_tracing_enabled.yml index bee04c0f88b..9a15c460bdc 100644 --- a/config/metrics/counts_all/20210216180951_projects_with_tracing_enabled.yml +++ b/config/metrics/counts_all/20210216180951_projects_with_tracing_enabled.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage.monitor.projects_with_tracing_enabled description: Projects with tracing enabled product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: tracing value_type: number diff --git a/config/metrics/counts_all/20210216180953_operations_dashboard_users_with_projects_added.yml b/config/metrics/counts_all/20210216180953_operations_dashboard_users_with_projects_added.yml index 5f8d7a53c7e..3f08f89b243 100644 --- a/config/metrics/counts_all/20210216180953_operations_dashboard_users_with_projects_added.yml +++ b/config/metrics/counts_all/20210216180953_operations_dashboard_users_with_projects_added.yml @@ -3,7 +3,7 @@ data_category: optional key_path: usage_activity_by_stage.monitor.operations_dashboard_users_with_projects_added description: Active users with projects on operations dashboard product_section: ops -product_stage: +product_stage: monitor product_group: group::monitor product_category: metrics value_type: number diff --git a/config/metrics/schema.json b/config/metrics/schema.json index 047012d443b..e55caa268b5 100644 --- a/config/metrics/schema.json +++ b/config/metrics/schema.json @@ -1,6 +1,6 @@ { "type": "object", - "required": ["key_path", "description", "value_type", "status", "product_group", "time_frame", "data_source", "distribution", "tier", "data_category", "milestone"], + "required": ["key_path", "description", "value_type", "status", "product_group", "product_stage", "time_frame", "data_source", "distribution", "tier", "data_category", "milestone"], "properties": { "key_path": { "type": "string" diff --git a/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb b/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb new file mode 100644 index 00000000000..675da2ea41c --- /dev/null +++ b/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddThrottleUnauthenticatedApiColumns < ActiveRecord::Migration[6.1] + def change + # The defaults match those from the current `throttle_unauthenticated_*` columns + add_column :application_settings, :throttle_unauthenticated_api_enabled, :boolean, default: false, null: false + add_column :application_settings, :throttle_unauthenticated_api_requests_per_period, :integer, default: 3600, null: false + add_column :application_settings, :throttle_unauthenticated_api_period_in_seconds, :integer, default: 3600, null: false + end +end diff --git a/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb b/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb new file mode 100644 index 00000000000..7615931464b --- /dev/null +++ b/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Initialize the new `throttle_unauthenticated_api_*` columns with the current values +# from the `throttle_unauthenticated_*` columns, which will now only apply to web requests. +# +# The columns for the unauthenticated web rate limit will be renamed later +# in https://gitlab.com/gitlab-org/gitlab/-/issues/340031. +class InitializeThrottleUnauthenticatedApiColumns < ActiveRecord::Migration[6.1] + class ApplicationSetting < ActiveRecord::Base + self.table_name = :application_settings + end + + def up + ApplicationSetting.update_all(%q{ + throttle_unauthenticated_api_enabled = throttle_unauthenticated_enabled, + throttle_unauthenticated_api_requests_per_period = throttle_unauthenticated_requests_per_period, + throttle_unauthenticated_api_period_in_seconds = throttle_unauthenticated_period_in_seconds + }) + end + + def down + end +end diff --git a/db/schema_migrations/20210826170902 b/db/schema_migrations/20210826170902 new file mode 100644 index 00000000000..f20877de3a5 --- /dev/null +++ b/db/schema_migrations/20210826170902 @@ -0,0 +1 @@ +97536098a2d3b127c6e6b9c079d10d272552dc9064f6b23fb92482baffaac7db
\ No newline at end of file diff --git a/db/schema_migrations/20210826171758 b/db/schema_migrations/20210826171758 new file mode 100644 index 00000000000..a0bb0f5cfc6 --- /dev/null +++ b/db/schema_migrations/20210826171758 @@ -0,0 +1 @@ +96a8a87cc075b7a2bf3919d0c891fdfedb2a9b7bab6460b82bfb43a3f8abe3cf
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 142a841fc69..afe3ab58393 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10337,6 +10337,9 @@ CREATE TABLE application_settings ( throttle_authenticated_git_lfs_period_in_seconds integer DEFAULT 60 NOT NULL, throttle_authenticated_git_lfs_enabled boolean DEFAULT false NOT NULL, user_deactivation_emails_enabled boolean DEFAULT true NOT NULL, + throttle_unauthenticated_api_enabled boolean DEFAULT false NOT NULL, + throttle_unauthenticated_api_requests_per_period integer DEFAULT 3600 NOT NULL, + throttle_unauthenticated_api_period_in_seconds integer DEFAULT 3600 NOT NULL, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)), CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), diff --git a/doc/ci/jobs/img/job_group_v12_10.png b/doc/ci/jobs/img/job_group_v12_10.png Binary files differdeleted file mode 100644 index 27e6bfbfc0f..00000000000 --- a/doc/ci/jobs/img/job_group_v12_10.png +++ /dev/null diff --git a/doc/ci/jobs/img/pipeline_delayed_job_v14_2.png b/doc/ci/jobs/img/pipeline_delayed_job_v14_2.png Binary files differnew file mode 100644 index 00000000000..8dbb118406c --- /dev/null +++ b/doc/ci/jobs/img/pipeline_delayed_job_v14_2.png diff --git a/doc/ci/jobs/img/pipeline_grouped_jobs_v14_2.png b/doc/ci/jobs/img/pipeline_grouped_jobs_v14_2.png Binary files differnew file mode 100644 index 00000000000..28be633770b --- /dev/null +++ b/doc/ci/jobs/img/pipeline_grouped_jobs_v14_2.png diff --git a/doc/ci/jobs/img/pipeline_incremental_rollout.png b/doc/ci/jobs/img/pipeline_incremental_rollout.png Binary files differdeleted file mode 100644 index b3498e9a5a5..00000000000 --- a/doc/ci/jobs/img/pipeline_incremental_rollout.png +++ /dev/null diff --git a/doc/ci/jobs/img/pipelines_grouped.png b/doc/ci/jobs/img/pipelines_grouped.png Binary files differdeleted file mode 100644 index 82814754747..00000000000 --- a/doc/ci/jobs/img/pipelines_grouped.png +++ /dev/null diff --git a/doc/ci/jobs/index.md b/doc/ci/jobs/index.md index 23d8e6a781f..54704d5574b 100644 --- a/doc/ci/jobs/index.md +++ b/doc/ci/jobs/index.md @@ -99,7 +99,7 @@ You can recognize when a pipeline has grouped jobs if you don't see the retry or cancel button inside them. Hovering over them shows the number of grouped jobs. Click to expand them. -![Grouped pipelines](img/pipelines_grouped.png) +![Grouped pipelines](img/pipeline_grouped_jobs_v14_2.png) To create a group of jobs, in the [CI/CD pipeline configuration file](../yaml/index.md), separate each job name with a number and one of the following: @@ -129,9 +129,7 @@ build ruby 3/3: - echo "ruby3" ``` -In the pipeline, the result is a group named `build ruby` with three jobs: - -![Job group](img/job_group_v12_10.png) +The pipeline graph displays a group named `build ruby` with three jobs. The jobs are ordered by comparing the numbers from left to right. You usually want the first number to be the index and the second number to be the total. @@ -179,7 +177,7 @@ For example, if you start rolling out new code and: - Users experience trouble with the new code, you can stop the timed incremental rollout by canceling the pipeline and [rolling](../environments/index.md#retry-or-roll-back-a-deployment) back to the last stable version. -![Pipelines example](img/pipeline_incremental_rollout.png) +![Pipelines example](img/pipeline_delayed_job_v14_2.png) ## Expand and collapse job log sections diff --git a/doc/ci/pipelines/img/manual_pipeline_v14_2.png b/doc/ci/pipelines/img/manual_pipeline_v14_2.png Binary files differnew file mode 100644 index 00000000000..df1c2a4760a --- /dev/null +++ b/doc/ci/pipelines/img/manual_pipeline_v14_2.png diff --git a/doc/ci/pipelines/img/pipelines.png b/doc/ci/pipelines/img/pipelines.png Binary files differdeleted file mode 100644 index a604fcb2587..00000000000 --- a/doc/ci/pipelines/img/pipelines.png +++ /dev/null diff --git a/doc/ci/pipelines/img/pipelines_graph_stage_view_v13_12.png b/doc/ci/pipelines/img/pipelines_graph_stage_view_v13_12.png Binary files differdeleted file mode 100644 index f2f38979e18..00000000000 --- a/doc/ci/pipelines/img/pipelines_graph_stage_view_v13_12.png +++ /dev/null diff --git a/doc/ci/pipelines/img/pipelines_graph_stage_view_v14_2.png b/doc/ci/pipelines/img/pipelines_graph_stage_view_v14_2.png Binary files differnew file mode 100644 index 00000000000..b0e9f63f743 --- /dev/null +++ b/doc/ci/pipelines/img/pipelines_graph_stage_view_v14_2.png diff --git a/doc/ci/pipelines/index.md b/doc/ci/pipelines/index.md index 4b97c3d761d..1eacc799636 100644 --- a/doc/ci/pipelines/index.md +++ b/doc/ci/pipelines/index.md @@ -210,11 +210,11 @@ allow you to require manual interaction before moving forward in the pipeline. You can do this straight from the pipeline graph. Just click the play button to execute that particular job. -For example, your pipeline might start automatically, but it requires manual action to -[deploy to production](../environments/index.md#configure-manual-deployments). In the example below, the `production` -stage has a job with a manual action. +For example, your pipeline can start automatically, but require a manual action to +[deploy to production](../environments/index.md#configure-manual-deployments). +In the example below, the `production` stage has a job with a manual action: -![Pipelines example](img/pipelines.png) +![Pipelines example](img/manual_pipeline_v14_2.png) #### Start multiple manual actions in a stage @@ -346,9 +346,9 @@ all the jobs in the pipeline. You can group the jobs by: -- Stage, which arranges jobs in the same stage together in the same column. +- Stage, which arranges jobs in the same stage together in the same column: - ![jobs grouped by stage](img/pipelines_graph_stage_view_v13_12.png) + ![jobs grouped by stage](img/pipelines_graph_stage_view_v14_2.png) - [Job dependencies](#view-job-dependencies-in-the-pipeline-graph), which arranges jobs based on their [`needs`](../yaml/index.md#needs) dependencies. diff --git a/doc/development/database_debugging.md b/doc/development/database_debugging.md index e2cff82fcfc..b1c8508c884 100644 --- a/doc/development/database_debugging.md +++ b/doc/development/database_debugging.md @@ -70,6 +70,36 @@ bundle exec rails db -e development - `SELECT * FROM schema_migrations WHERE version = '20170926203418';`: Check if a migration was run - `DELETE FROM schema_migrations WHERE version = '20170926203418';`: Manually remove a migration +## Access the database with a GUI + +Most GUIs (DataGrid, RubyMine, DBeaver) require a TCP connection to the database, but by default +the database runs on a UNIX socket. To be able to access the database from these tools, some steps +are needed: + +1. On the GDK root directory, run: + + ```shell + gdk config set postgresql.host localhost + ``` + +1. Open your `gdk.yml`, and confirm that it has the following lines: + + ```yaml + postgresql: + host: localhost + ``` + +1. Reconfigure GDK: + + ```shell + gdk reconfigure + ``` + +1. On your database GUI, select `localhost` as host, `5432` as port and `gitlabhq_development` as database. + Alternatively, you can use the connection string `postgresql://localhost:5432/gitlabhq_development`. + +The new connection should be working now. + ## Access the GDK database with Visual Studio Code Use these instructions for exploring the GitLab database while developing with the GDK: diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index cd50849309f..79664490368 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -1211,6 +1211,8 @@ GitLab uses [factory_bot](https://github.com/thoughtbot/factory_bot) as a test f - Factories don't have to be limited to `ActiveRecord` objects. [See example](https://gitlab.com/gitlab-org/gitlab-foss/commit/0b8cefd3b2385a21cfed779bd659978c0402766d). - Factories and their traits should produce valid objects that are [verified by specs](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/factories_spec.rb). +- Avoid the use of [`skip_callback`](https://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html#method-i-skip_callback) in factories. + See [issue #247865](https://gitlab.com/gitlab-org/gitlab/-/issues/247865) for details. ### Fixtures diff --git a/doc/user/infrastructure/clusters/manage/management_project_applications/runner.md b/doc/user/infrastructure/clusters/manage/management_project_applications/runner.md index ec6f783c010..56f1e07389a 100644 --- a/doc/user/infrastructure/clusters/manage/management_project_applications/runner.md +++ b/doc/user/infrastructure/clusters/manage/management_project_applications/runner.md @@ -33,7 +33,7 @@ These values can be specified using [CI/CD variables](../../../../../ci/variable - `CI_SERVER_URL` is used for `gitlabUrl`. If you are using GitLab.com, you don't need to set this variable. - `GITLAB_RUNNER_REGISTRATION_TOKEN` is used for `runnerRegistrationToken` -The methods of specifying these values are mutually exclusive. Either specify variables `GITLAB_RUNNER_REGISTRATION_TOKEN` and `GITLAB_RUNNER_TOKEN` as CI variables (recommended) or provide values for `runnerRegistrationToken:` and `runnerToken:` in `applications/gitlab-runner/values.yaml.gotmpl`. +The methods of specifying these values are mutually exclusive. Either specify variables `GITLAB_RUNNER_REGISTRATION_TOKEN` and `CI_SERVER_URL` as CI variables (recommended) or provide values for `runnerRegistrationToken:` and `gitlabUrl:` in `applications/gitlab-runner/values.yaml.gotmpl`. The runner registration token allows connection to a project by a runner and therefore should be treated as a secret to prevent malicious use and code exfiltration through a runner. For this reason, we recommend that you specify the runner registration token as a [protected variable](../../../../../ci/variables/index.md#protect-a-cicd-variable) and [masked variable](../../../../../ci/variables/index.md#mask-a-cicd-variable) and do not commit them to the Git repository in the `values.yaml.gotmpl` file. diff --git a/lib/sidebars/projects/menus/learn_gitlab_menu.rb b/lib/sidebars/projects/menus/learn_gitlab_menu.rb index 9de141e465f..16335f5b076 100644 --- a/lib/sidebars/projects/menus/learn_gitlab_menu.rb +++ b/lib/sidebars/projects/menus/learn_gitlab_menu.rb @@ -23,7 +23,7 @@ module Sidebars override :has_pill? def has_pill? - context.learn_gitlab_experiment_enabled + context.learn_gitlab_enabled end override :pill_count @@ -52,7 +52,7 @@ module Sidebars override :render? def render? - context.learn_gitlab_experiment_enabled + context.learn_gitlab_enabled end end end diff --git a/qa/qa/support/formatters/test_stats_formatter.rb b/qa/qa/support/formatters/test_stats_formatter.rb index 91fdc902e2d..098796fe0b9 100644 --- a/qa/qa/support/formatters/test_stats_formatter.rb +++ b/qa/qa/support/formatters/test_stats_formatter.rb @@ -41,14 +41,14 @@ module QA # # @return [String] def influxdb_url - @influxdb_url ||= ENV['QA_INFLUXDB_URL'] + @influxdb_url ||= env('QA_INFLUXDB_URL') end # Influxdb token # # @return [String] def influxdb_token - @influxdb_token ||= ENV['QA_INFLUXDB_TOKEN'] + @influxdb_token ||= env('QA_INFLUXDB_TOKEN') end # Transform example to influxdb compatible metrics data @@ -69,14 +69,14 @@ module QA retried: ((example.metadata[:retry_attempts] || 0) > 0).to_s, job_name: job_name, merge_request: merge_request, - run_type: ENV['QA_RUN_TYPE'] + run_type: env('QA_RUN_TYPE') || run_type }, fields: { id: example.id, run_time: (example.execution_result.run_time * 1000).round, retry_attempts: example.metadata[:retry_attempts] || 0, job_url: QA::Runtime::Env.ci_job_url, - pipeline_id: ENV['CI_PIPELINE_ID'] + pipeline_id: env('CI_PIPELINE_ID') } } rescue StandardError => e @@ -84,25 +84,51 @@ module QA nil end + # Project name + # + # @return [String] + def project_name + @project_name ||= QA::Runtime::Env.ci_project_name + end + + # Base ci job name + # + # @return [String] + def job_name + @job_name ||= QA::Runtime::Env.ci_job_name.gsub(%r{ \d{1,2}/\d{1,2}}, '') + end + # Single common timestamp for all exported example metrics to keep data points consistently grouped # # @return [Time] def time - @time ||= DateTime.strptime(ENV['CI_PIPELINE_CREATED_AT']).to_time + @time ||= DateTime.strptime(env('CI_PIPELINE_CREATED_AT')).to_time end # Is a merge request execution # # @return [String] def merge_request - @merge_request ||= (!!ENV['CI_MERGE_REQUEST_IID'] || !!ENV['TOP_UPSTREAM_MERGE_REQUEST_IID']).to_s + @merge_request ||= (!!env('CI_MERGE_REQUEST_IID') || !!env('TOP_UPSTREAM_MERGE_REQUEST_IID')).to_s end - # Base ci job name + # Test run type from staging, canary or production env # - # @return [String] - def job_name - @job_name ||= QA::Runtime::Env.ci_job_name.gsub(%r{ \d{1,2}/\d{1,2}}, '') + # @return [String>, nil] + def run_type + return unless %w[staging canary production].include?(project_name) + + @run_type ||= begin + test_subset = if env('NO_ADMIN') == 'true' + 'sanity-no-admin' + elsif env('SMOKE_ONLY') == 'true' + 'sanity' + else + 'full' + end + + "#{project_name}-#{test_subset}" + end end # Print log message @@ -113,6 +139,16 @@ module QA def log(level, message) QA::Runtime::Logger.public_send(level, "influxdb exporter: #{message}") end + + # Return non empty environment variable value + # + # @param [String] name + # @return [String, nil] + def env(name) + return unless ENV[name] && !ENV[name].empty? + + ENV[name] + end end end end diff --git a/qa/spec/support/formatters/test_stats_formatter_spec.rb b/qa/spec/support/formatters/test_stats_formatter_spec.rb index 30ffa5839e6..41f8af4b0d0 100644 --- a/qa/spec/support/formatters/test_stats_formatter_spec.rb +++ b/qa/spec/support/formatters/test_stats_formatter_spec.rb @@ -13,6 +13,8 @@ describe QA::Support::Formatters::TestStatsFormatter do let(:ci_job_url) { "url" } let(:ci_pipeline_id) { "123" } let(:run_type) { 'staging-full' } + let(:reliable) { 'false' } + let(:quarantined) { 'false' } let(:influx_client) { instance_double('InfluxDB2::Client', create_write_api: influx_write_api) } let(:influx_write_api) { instance_double('InfluxDB2::WriteApi', write: nil) } @@ -30,7 +32,7 @@ describe QA::Support::Formatters::TestStatsFormatter do name: 'test-stats', time: DateTime.strptime(ci_timestamp).to_time, tags: { - name: "stats export #{spec_name}", + name: 'stats export spec', file_path: './spec/support/formatters/test_stats_formatter_spec.rb', status: :passed, reliable: reliable, @@ -51,6 +53,8 @@ describe QA::Support::Formatters::TestStatsFormatter do end def run_spec(&spec) + spec ||= -> { it('spec') {} } + describe_successfully('stats export', &spec) send_stop_notification end @@ -74,9 +78,7 @@ describe QA::Support::Formatters::TestStatsFormatter do stub_env('QA_INFLUXDB_URL', nil) stub_env('QA_INFLUXDB_TOKEN', nil) - run_spec do - it('skips export') {} - end + run_spec expect(influx_client).not_to have_received(:create_write_api) end @@ -85,9 +87,7 @@ describe QA::Support::Formatters::TestStatsFormatter do stub_env('QA_INFLUXDB_URL', url) stub_env('QA_INFLUXDB_TOKEN', nil) - run_spec do - it('skips export') {} - end + run_spec expect(influx_client).not_to have_received(:create_write_api) end @@ -111,11 +111,10 @@ describe QA::Support::Formatters::TestStatsFormatter do context 'with reliable spec' do let(:reliable) { 'true' } - let(:quarantined) { 'false' } - it 'exports data to influxdb' do + it 'exports data to influxdb with correct reliable tag' do run_spec do - it('exports data', :reliable) {} + it('spec', :reliable) {} end expect(influx_write_api).to have_received(:write).with(data: [data]) @@ -123,16 +122,47 @@ describe QA::Support::Formatters::TestStatsFormatter do end context 'with quarantined spec' do - let(:reliable) { 'false' } let(:quarantined) { 'true' } - it 'exports data to influxdb' do + it 'exports data to influxdb with correct quarantine tag' do run_spec do - it('exports data', :quarantine) {} + it('spec', :quarantine) {} end expect(influx_write_api).to have_received(:write).with(data: [data]) end end + + context 'with staging full run' do + let(:run_type) { 'staging-full' } + + before do + stub_env('CI_PROJECT_NAME', 'staging') + stub_env('QA_RUN_TYPE', nil) + end + + it 'exports data to influxdb with correct run type' do + run_spec + + expect(influx_write_api).to have_received(:write).with(data: [data]) + end + end + + context 'with staging sanity no admin' do + let(:run_type) { 'staging-sanity-no-admin' } + + before do + stub_env('CI_PROJECT_NAME', 'staging') + stub_env('NO_ADMIN', 'true') + stub_env('SMOKE_ONLY', 'true') + stub_env('QA_RUN_TYPE', nil) + end + + it 'exports data to influxdb with correct run type' do + run_spec + + expect(influx_write_api).to have_received(:write).with(data: [data]) + end + end end end diff --git a/spec/controllers/projects/learn_gitlab_controller_spec.rb b/spec/controllers/projects/learn_gitlab_controller_spec.rb index 90d00767f92..620982f73be 100644 --- a/spec/controllers/projects/learn_gitlab_controller_spec.rb +++ b/spec/controllers/projects/learn_gitlab_controller_spec.rb @@ -7,13 +7,13 @@ RSpec.describe Projects::LearnGitlabController do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, namespace: user.namespace) } - let(:learn_gitlab_experiment_enabled) { true } + let(:learn_gitlab_enabled) { true } let(:params) { { namespace_id: project.namespace.to_param, project_id: project } } subject { get :index, params: params } before do - allow(controller.helpers).to receive(:learn_gitlab_experiment_enabled?).and_return(learn_gitlab_experiment_enabled) + allow(controller.helpers).to receive(:learn_gitlab_enabled?).and_return(learn_gitlab_enabled) end context 'unauthenticated user' do @@ -28,7 +28,7 @@ RSpec.describe Projects::LearnGitlabController do it { is_expected.to render_template(:index) } context 'learn_gitlab experiment not enabled' do - let(:learn_gitlab_experiment_enabled) { false } + let(:learn_gitlab_enabled) { false } it { is_expected.to have_gitlab_http_status(:not_found) } end diff --git a/spec/features/groups/packages_spec.rb b/spec/features/groups/packages_spec.rb index 9a7950266a5..3c2ade6b274 100644 --- a/spec/features/groups/packages_spec.rb +++ b/spec/features/groups/packages_spec.rb @@ -44,14 +44,6 @@ RSpec.describe 'Group Packages' do it_behaves_like 'packages list', check_project_name: true - context 'when package_details_apollo feature flag is off' do - before do - stub_feature_flags(package_details_apollo: false) - end - - it_behaves_like 'package details link' - end - it_behaves_like 'package details link' it 'allows you to navigate to the project page' do diff --git a/spec/features/projects/package_files_spec.rb b/spec/features/projects/package_files_spec.rb index c5c03396d71..6dc0294bb9e 100644 --- a/spec/features/projects/package_files_spec.rb +++ b/spec/features/projects/package_files_spec.rb @@ -23,20 +23,6 @@ RSpec.describe 'PackageFiles' do expect(status_code).to eq(200) end - context 'when package_details_apollo feature flag is off' do - before do - stub_feature_flags(package_details_apollo: false) - end - - it 'renders the download link with the correct url', :js do - visit project_package_path(project, package) - - download_url = download_project_package_file_path(project, package_file) - - expect(page).to have_link(package_file.file_name, href: download_url) - end - end - it 'does not allow download of package belonging to different project' do another_package = create(:maven_package) another_file = another_package.package_files.first diff --git a/spec/features/projects/packages_spec.rb b/spec/features/projects/packages_spec.rb index 30298f79312..7fcc8200b1c 100644 --- a/spec/features/projects/packages_spec.rb +++ b/spec/features/projects/packages_spec.rb @@ -37,14 +37,6 @@ RSpec.describe 'Packages' do it_behaves_like 'packages list' - context 'when package_details_apollo feature flag is off' do - before do - stub_feature_flags(package_details_apollo: false) - end - - it_behaves_like 'package details link' - end - it_behaves_like 'package details link' context 'deleting a package' do diff --git a/spec/frontend/boards/board_card_inner_spec.js b/spec/frontend/boards/board_card_inner_spec.js index 7d3ecc773a6..e0446811f64 100644 --- a/spec/frontend/boards/board_card_inner_spec.js +++ b/spec/frontend/boards/board_card_inner_spec.js @@ -2,6 +2,7 @@ import { GlLabel, GlLoadingIcon, GlTooltip } from '@gitlab/ui'; import { range } from 'lodash'; import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; +import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import BoardBlockedIcon from '~/boards/components/board_blocked_icon.vue'; import BoardCardInner from '~/boards/components/board_card_inner.vue'; @@ -44,6 +45,7 @@ describe('Board card component', () => { const findEpicBadgeProgress = () => wrapper.findByTestId('epic-progress'); const findEpicCountablesTotalWeight = () => wrapper.findByTestId('epic-countables-total-weight'); const findEpicProgressTooltip = () => wrapper.findByTestId('epic-progress-tooltip-content'); + const findHiddenIssueIcon = () => wrapper.findByTestId('hidden-icon'); const createStore = ({ isEpicBoard = false, isProjectBoard = false } = {}) => { store = new Vuex.Store({ @@ -72,6 +74,9 @@ describe('Board card component', () => { GlLabel: true, GlLoadingIcon: true, }, + directives: { + GlTooltip: createMockDirective(), + }, mocks: { $apollo: { queries: { @@ -122,6 +127,10 @@ describe('Board card component', () => { expect(wrapper.find('.confidential-icon').exists()).toBe(false); }); + it('does not render hidden issue icon', () => { + expect(findHiddenIssueIcon().exists()).toBe(false); + }); + it('renders issue ID with #', () => { expect(wrapper.find('.board-card-number').text()).toContain(`#${issue.iid}`); }); @@ -184,6 +193,30 @@ describe('Board card component', () => { }); }); + describe('hidden issue', () => { + beforeEach(() => { + wrapper.setProps({ + item: { + ...wrapper.props('item'), + hidden: true, + }, + }); + }); + + it('renders hidden issue icon', () => { + expect(findHiddenIssueIcon().exists()).toBe(true); + }); + + it('displays a tooltip which explains the meaning of the icon', () => { + const tooltip = getBinding(findHiddenIssueIcon().element, 'gl-tooltip'); + + expect(tooltip).toBeDefined(); + expect(findHiddenIssueIcon().attributes('title')).toBe( + 'This issue is hidden because its author has been banned', + ); + }); + }); + describe('with assignee', () => { describe('with avatar', () => { beforeEach(() => { diff --git a/spec/frontend/projects/storage_counter/mock_data.js b/spec/frontend/projects/storage_counter/mock_data.js index a7e19e679d2..8561a2714c6 100644 --- a/spec/frontend/projects/storage_counter/mock_data.js +++ b/spec/frontend/projects/storage_counter/mock_data.js @@ -4,6 +4,7 @@ export const mockGetProjectStorageCountGraphQLResponse = { id: 'gid://gitlab/Project/20', statistics: { buildArtifactsSize: 400000.0, + pipelineArtifactsSize: 25000.0, lfsObjectsSize: 4800000.0, packagesSize: 3800000.0, repositorySize: 3900000.0, diff --git a/spec/helpers/learn_gitlab_helper_spec.rb b/spec/helpers/learn_gitlab_helper_spec.rb index f148dd4a8ba..1159fd96d59 100644 --- a/spec/helpers/learn_gitlab_helper_spec.rb +++ b/spec/helpers/learn_gitlab_helper_spec.rb @@ -53,7 +53,7 @@ RSpec.describe LearnGitlabHelper do end end - describe '.learn_gitlab_experiment_enabled?' do + describe '.learn_gitlab_enabled?' do using RSpec::Parameterized::TableSyntax let_it_be(:user) { create(:user) } @@ -61,7 +61,7 @@ RSpec.describe LearnGitlabHelper do let(:params) { { namespace_id: project.namespace.to_param, project_id: project } } - subject { helper.learn_gitlab_experiment_enabled?(project) } + subject { helper.learn_gitlab_enabled?(project) } where(:onboarding, :learn_gitlab_available, :result) do true | true | true diff --git a/spec/helpers/packages_helper_spec.rb b/spec/helpers/packages_helper_spec.rb index bc60c582ff8..06c6cccd488 100644 --- a/spec/helpers/packages_helper_spec.rb +++ b/spec/helpers/packages_helper_spec.rb @@ -223,21 +223,41 @@ RSpec.describe PackagesHelper do describe '#package_details_data' do let_it_be(:package) { create(:package) } + let(:expected_result) do + { + package_id: package.id, + can_delete: 'true', + project_name: project.name, + group_list_url: '' + } + end + before do allow(helper).to receive(:current_user) { project.owner } allow(helper).to receive(:can?) { true } end - it 'when use_presenter is true populate the package key' do - result = helper.package_details_data(project, package, true) + context 'in a project without a group' do + it 'populates presenter data' do + result = helper.package_details_data(project, package) - expect(result[:package]).not_to be_nil + expect(result).to match(hash_including(expected_result)) + end end - it 'when use_presenter is false the package key is nil' do - result = helper.package_details_data(project, package, false) + context 'in a project with a group' do + let_it_be(:group) { create(:group) } + let_it_be(:project_with_group) { create(:project, group: group) } - expect(result[:package]).to be_nil + it 'populates presenter data' do + result = helper.package_details_data(project_with_group, package) + expected = expected_result.merge({ + group_list_url: group_packages_path(project_with_group.group), + project_name: project_with_group.name + }) + + expect(result).to match(hash_including(expected)) + end end end end diff --git a/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb b/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb index a0f93efbda3..36a76e70a48 100644 --- a/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb +++ b/spec/lib/sidebars/projects/menus/learn_gitlab_menu_spec.rb @@ -4,13 +4,13 @@ require 'spec_helper' RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do let_it_be(:project) { build(:project) } - let_it_be(:experiment_enabled) { true } + let_it_be(:learn_gitlab_enabled) { true } let(:context) do Sidebars::Projects::Context.new( current_user: nil, container: project, - learn_gitlab_experiment_enabled: experiment_enabled + learn_gitlab_enabled: learn_gitlab_enabled ) end @@ -43,7 +43,7 @@ RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do end context 'when learn gitlab experiment is disabled' do - let(:experiment_enabled) { false } + let(:learn_gitlab_enabled) { false } it 'returns false' do expect(subject.render?).to eq false @@ -59,7 +59,7 @@ RSpec.describe Sidebars::Projects::Menus::LearnGitlabMenu do end context 'when learn gitlab experiment is disabled' do - let(:experiment_enabled) { false } + let(:learn_gitlab_enabled) { false } it 'returns false' do expect(subject.has_pill?).to eq false diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index c4fc50473a7..17c1adb9e2a 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -927,6 +927,8 @@ RSpec.describe ApplicationSetting do context 'throttle_* settings' do where(:throttle_setting) do %i[ + throttle_unauthenticated_api_requests_per_period + throttle_unauthenticated_api_period_in_seconds throttle_unauthenticated_requests_per_period throttle_unauthenticated_period_in_seconds throttle_authenticated_api_requests_per_period diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 0b76dc3f87f..a7807852b74 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -4556,44 +4556,6 @@ RSpec.describe Project, factory_default: :keep do end end - describe '#legacy_remove_pages' do - let(:project) { create(:project).tap { |project| project.mark_pages_as_deployed } } - let(:pages_metadatum) { project.pages_metadatum } - let(:namespace) { project.namespace } - let(:pages_path) { project.pages_path } - - around do |example| - FileUtils.mkdir_p(pages_path) - begin - example.run - ensure - FileUtils.rm_rf(pages_path) - end - end - - it 'removes the pages directory and marks the project as not having pages deployed' do - expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return(true) - expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, namespace.full_path, anything) - - expect { project.legacy_remove_pages }.to change { pages_metadatum.reload.deployed }.from(true).to(false) - end - - it 'does nothing if updates on legacy storage are disabled' do - allow(Settings.pages.local_store).to receive(:enabled).and_return(false) - - expect(Gitlab::PagesTransfer).not_to receive(:new) - expect(PagesWorker).not_to receive(:perform_in) - - project.legacy_remove_pages - end - - it 'is run when the project is destroyed' do - expect(project).to receive(:legacy_remove_pages).and_call_original - - expect { project.destroy! }.not_to raise_error - end - end - describe '#remove_export' do let(:project) { create(:project, :with_export) } diff --git a/spec/requests/api/pages/pages_spec.rb b/spec/requests/api/pages/pages_spec.rb index f4c6de00e40..0eb2ae64f43 100644 --- a/spec/requests/api/pages/pages_spec.rb +++ b/spec/requests/api/pages/pages_spec.rb @@ -36,12 +36,7 @@ RSpec.describe API::Pages do end it 'removes the pages' do - expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true - expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything) - - Sidekiq::Testing.inline! do - delete api("/projects/#{project.id}/pages", admin ) - end + delete api("/projects/#{project.id}/pages", admin ) expect(project.reload.pages_metadatum.deployed?).to be(false) end diff --git a/spec/services/application_settings/update_service_spec.rb b/spec/services/application_settings/update_service_spec.rb index a0c30620302..a1fd89bcad7 100644 --- a/spec/services/application_settings/update_service_spec.rb +++ b/spec/services/application_settings/update_service_spec.rb @@ -345,6 +345,9 @@ RSpec.describe ApplicationSettings::UpdateService do throttle_authenticated_web_enabled: true, throttle_authenticated_web_period_in_seconds: 30, throttle_authenticated_web_requests_per_period: 40, + throttle_unauthenticated_api_enabled: true, + throttle_unauthenticated_api_period_in_seconds: 50, + throttle_unauthenticated_api_requests_per_period: 60, throttle_unauthenticated_enabled: true, throttle_unauthenticated_period_in_seconds: 50, throttle_unauthenticated_requests_per_period: 60 diff --git a/spec/services/pages/delete_service_spec.rb b/spec/services/pages/delete_service_spec.rb index 295abe15bf0..e02e8e72e0b 100644 --- a/spec/services/pages/delete_service_spec.rb +++ b/spec/services/pages/delete_service_spec.rb @@ -12,27 +12,6 @@ RSpec.describe Pages::DeleteService do project.mark_pages_as_deployed end - it 'deletes published pages', :sidekiq_inline do - expect_next_instance_of(Gitlab::PagesTransfer) do |pages_transfer| - expect(pages_transfer).to receive(:rename_project).and_return true - end - - expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything) - - service.execute - end - - it "doesn't remove anything from the legacy storage if local_store is disabled", :sidekiq_inline do - allow(Settings.pages.local_store).to receive(:enabled).and_return(false) - - expect(project.pages_deployed?).to be(true) - expect(PagesWorker).not_to receive(:perform_in) - - service.execute - - expect(project.pages_deployed?).to be(false) - end - it 'marks pages as not deployed' do expect do service.execute diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 2a0c794cebb..6d0b75e0c95 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -18,10 +18,6 @@ RSpec.describe Projects::UpdatePagesService do subject { described_class.new(project, build) } - before do - project.legacy_remove_pages - end - context 'for new artifacts' do context "for a valid job" do let!(:artifacts_archive) { create(:ci_job_artifact, :correct_checksum, file: file, job: build) } diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 9a31d599808..adfe1cee6d6 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -68,8 +68,8 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end describe 'Learn GitLab' do - it 'has a link to the learn GitLab experiment' do - allow(view).to receive(:learn_gitlab_experiment_enabled?).and_return(true) + it 'has a link to the learn GitLab' do + allow(view).to receive(:learn_gitlab_enabled?).and_return(true) allow_next_instance_of(LearnGitlab::Onboarding) do |onboarding| expect(onboarding).to receive(:completed_percentage).and_return(20) end diff --git a/spec/workers/namespaceless_project_destroy_worker_spec.rb b/spec/workers/namespaceless_project_destroy_worker_spec.rb index cd66af82364..93e8415f3bb 100644 --- a/spec/workers/namespaceless_project_destroy_worker_spec.rb +++ b/spec/workers/namespaceless_project_destroy_worker_spec.rb @@ -48,12 +48,6 @@ RSpec.describe NamespacelessProjectDestroyWorker do subject.perform(project.id) end - - it 'does not do anything in Project#legacy_remove_pages method' do - expect(Gitlab::PagesTransfer).not_to receive(:new) - - subject.perform(project.id) - end end context 'project forked from another' do diff --git a/spec/workers/pages_remove_worker_spec.rb b/spec/workers/pages_remove_worker_spec.rb index 864aa763fa9..9d49088b371 100644 --- a/spec/workers/pages_remove_worker_spec.rb +++ b/spec/workers/pages_remove_worker_spec.rb @@ -3,23 +3,9 @@ require 'spec_helper' RSpec.describe PagesRemoveWorker do - let(:project) { create(:project, path: "my.project")} - let!(:domain) { create(:pages_domain, project: project) } - - subject { described_class.new.perform(project.id) } - - before do - project.mark_pages_as_deployed - end - - it 'deletes published pages' do - expect(project.pages_deployed?).to be(true) - - expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true - expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything) - - subject - - expect(project.reload.pages_deployed?).to be(false) + it 'does not raise error' do + expect do + described_class.new.perform(create(:project).id) + end.not_to raise_error end end |